(notonline)-->
without js -- (sockets)
include builtins\sockets.e
constant msg = "hello socket world"
atom sock = socket(AF_INET, SOCK_STREAM)
if sock>=0 then
atom pSockAddr = sockaddr_in(AF_INET, "localhost", 256)
integer res = connect(sock, pSockAddr)
if res=SOCKET_ERROR then
crash("connect (%v)",{get_socket_error()})
end if
string pm = msg
while true do
integer len = length(pm),
slen = send(sock, pm)
if slen<0 or slen=len then exit end if
pm = pm[slen+1..$]
end while
closesocket(sock)
end if
WSACleanup()