SCM Repository
Annotation of /sml/trunk/src/smlnj-lib/INet/sock-util-sig.sml
Parent Directory
|
Revision Log
Revision 967 - (view) (download)
1 : | monnier | 409 | (* 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 : | jhr | 967 | val addrFromString : string -> {host : hostname, port : port option} option |
27 : | monnier | 409 | |
28 : | exception BadAddr of string | ||
29 : | |||
30 : | val resolveAddr : {host : hostname, port : port option} | ||
31 : | -> {host : string, addr : NetHostDB.in_addr, port : int option} | ||
32 : | (* Given a hostname and optional port, resolve them in the host | ||
33 : | * and service database. If either the host or service name is not | ||
34 : | * found, then BadAddr is raised. | ||
35 : | *) | ||
36 : | |||
37 : | type 'a stream_sock = ('a, Socket.active Socket.stream) Socket.sock | ||
38 : | |||
39 : | val connectINetStrm : {addr : NetHostDB.in_addr, port : int} | ||
40 : | -> INetSock.inet stream_sock | ||
41 : | (* establish a client-side connection to a INET domain stream socket *) | ||
42 : | |||
43 : | val recvVec : ('a stream_sock * int) -> Word8Vector.vector | ||
44 : | val recvStr : ('a stream_sock * int) -> string | ||
45 : | val sendVec : ('a stream_sock * Word8Vector.vector) -> unit | ||
46 : | val sendStr : ('a stream_sock * string) -> unit | ||
47 : | val sendArr : ('a stream_sock * Word8Array.array) -> unit | ||
48 : | |||
49 : | end; |
root@smlnj-gforge.cs.uchicago.edu | ViewVC Help |
Powered by ViewVC 1.0.0 |