Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Annotation of /sml/trunk/src/smlnj-lib/INet/sock-util-sig.sml
ViewVC logotype

Annotation of /sml/trunk/src/smlnj-lib/INet/sock-util-sig.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 651 - (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 :    
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 :     val connectINetStrm : {addr : NetHostDB.in_addr, port : int}
39 :     -> INetSock.inet stream_sock
40 :     (* establish a client-side connection to a INET domain stream socket *)
41 :    
42 :     val recvVec : ('a stream_sock * int) -> Word8Vector.vector
43 :     val recvStr : ('a stream_sock * int) -> string
44 :     val sendVec : ('a stream_sock * Word8Vector.vector) -> unit
45 :     val sendStr : ('a stream_sock * string) -> unit
46 :     val sendArr : ('a stream_sock * Word8Array.array) -> unit
47 :    
48 :     end;

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0