program WIN32CUI 'Sample';
#include 'ziron32.zir';
#include 'smm32.zir';
#include 'kernel32.zir';
#include 'user32.zir';
#include 'messages.zir';
#include 'wsock32.zir';
#include 'console.zir';
const DEFAULT_PORT = 1111;
WSADATA ws;
WSOCKET listensocket;
WSOCKET clientsocket;
sockaddr_in addrinfo;
EAX = WSAStartup(WSOCKVER2_2, @ws);
listensocket = socket(PF_INET, SOCK_STREAM, 0);
addrinfo.sin_family = AF_INET;
addrinfo.sin_addr = INADDR_ANY;
addrinfo.sin_port = htons(DEFAULT_PORT);
bind(listensocket, @addrinfo, sizeof sockaddr_in);
listen(listensocket, 20);
while () {
clientsocket = accept(listensocket, nil, nil);
send(clientsocket, 'Hello World!', 12, 0);
closesocket(clientsocket);
}
//console will never get here. but just in case.
ExitProcess(0);