SCM Repository
Annotation of /sml/branches/SMLNJ/src/smlnj-lib/Unix/sock-util-sig.sml
Parent Directory
|
Revision Log
Revision 3 - (view) (download)
1 : | monnier | 2 | (* sock-util-sig.sml |
2 : | * | ||
3 : | * COPYRIGHT (c) 1996 AT&T Research. | ||
4 : | * | ||
5 : | * Various utility functions for programming with sockets. | ||
6 : | *) | ||
7 : | |||
8 : | signature SOCK_UTIL = | ||
9 : | sig | ||
10 : | |||
11 : | datatype port = PortNumber of int | ServName of string | ||
12 : | (* a port can be identified by number, or by the name of a service *) | ||
13 : | |||
14 : | datatype hostname = HostName of string | HostAddr of NetHostDB.in_addr | ||
15 : | |||
16 : | val scanAddr : (char, 'a) StringCvt.reader | ||
17 : | -> ({host : hostname, port : port option}, 'a) StringCvt.reader | ||
18 : | (* scan an address, which has the form | ||
19 : | * addr [ ":" port ] | ||
20 : | * where the addr may either be numeric or symbolic host name and the | ||
21 : | * port is either a service name or a decimal number. Legal host names | ||
22 : | * must begin with a letter, and may contain any alphanumeric character, | ||
23 : | * the minus sign (-) and period (.), where the period is used as a | ||
24 : | * domain separator. | ||
25 : | *) | ||
26 : | |||
27 : | exception BadAddr of string | ||
28 : | |||
29 : | val resolveAddr : {host : hostname, port : port option} | ||
30 : | -> {host : string, addr : NetHostDB.in_addr, port : int option} | ||
31 : | (* Given a hostname and optional port, resolve them in the host | ||
32 : | * and service database. If either the host or service name is not | ||
33 : | * found, then BadAddr is raised. | ||
34 : | *) | ||
35 : | |||
36 : | type 'a stream_sock = ('a, Socket.active Socket.stream) Socket.sock | ||
37 : | |||
38 : | (** NOTE: we should probably move this somewhere else, since it is not | ||
39 : | ** portable to non-Unix systems. | ||
40 : | **) | ||
41 : | val connectUnixStrm : string -> UnixSock.unix stream_sock | ||
42 : | (* establish a client-side connection to a Unix-domain stream socket *) | ||
43 : | val connectINetStrm : {addr : NetHostDB.in_addr, port : int} | ||
44 : | -> INetSock.inet stream_sock | ||
45 : | (* establish a client-side connection to a INET domain stream socket *) | ||
46 : | |||
47 : | val recvVec : ('a stream_sock * int) -> Word8Vector.vector | ||
48 : | val recvStr : ('a stream_sock * int) -> string | ||
49 : | val sendVec : ('a stream_sock * Word8Vector.vector) -> unit | ||
50 : | val sendStr : ('a stream_sock * string) -> unit | ||
51 : | val sendArr : ('a stream_sock * Word8Array.array) -> unit | ||
52 : | |||
53 : | end; |
root@smlnj-gforge.cs.uchicago.edu | ViewVC Help |
Powered by ViewVC 1.0.0 |