55 |
PC.wrap (scanName, ServName), |
PC.wrap (scanName, ServName), |
56 |
PC.wrap (Int.scan StringCvt.DEC, PortNumber))))) getc strm |
PC.wrap (Int.scan StringCvt.DEC, PortNumber))))) getc strm |
57 |
|
|
58 |
|
val addrFromString = StringCvt.scanString scanAddr |
59 |
|
|
60 |
exception BadAddr of string |
exception BadAddr of string |
61 |
|
|
62 |
fun resolveAddr {host, port} = let |
fun resolveAddr {host, port} = let |
113 |
(* send the complete contents of a vector *) |
(* send the complete contents of a vector *) |
114 |
fun sendVec (sock, vec) = let |
fun sendVec (sock, vec) = let |
115 |
val len = Word8Vector.length vec |
val len = Word8Vector.length vec |
116 |
fun send i = Socket.sendVec (sock, {buf=vec, i=i, sz=NONE}) |
fun send i = Socket.sendVec (sock, |
117 |
|
Word8VectorSlice.slice (vec, i, NONE)) |
118 |
fun put i = if (i < len) |
fun put i = if (i < len) |
119 |
then put(i + send i) |
then put(i + send i) |
120 |
else () |
else () |
127 |
(* send the complete contents of an array *) |
(* send the complete contents of an array *) |
128 |
fun sendArr (sock, arr) = let |
fun sendArr (sock, arr) = let |
129 |
val len = Word8Array.length arr |
val len = Word8Array.length arr |
130 |
fun send i = Socket.sendArr (sock, {buf=arr, i=i, sz=NONE}) |
fun send i = Socket.sendArr (sock, |
131 |
|
Word8ArraySlice.slice (arr, i, NONE)) |
132 |
fun put i = if (i < len) |
fun put i = if (i < len) |
133 |
then put(i + send i) |
then put(i + send i) |
134 |
else () |
else () |