Skip to content

Instantly share code, notes, and snippets.

@jerstlouis
Last active August 29, 2015 14:01
Show Gist options
  • Save jerstlouis/0d162e7f65376f870fe8 to your computer and use it in GitHub Desktop.
Save jerstlouis/0d162e7f65376f870fe8 to your computer and use it in GitHub Desktop.
import "ecere"
ConsoleFile con { };
class MySocket : Socket
{
unsigned int OnReceive(unsigned char * buffer, unsigned int count)
{
con.Write(buffer, 1, count);
return count;
}
}
Service myService
{
port = 1234;
void OnAccept()
{
MySocket { this };
}
};
MySocket udpSocket { };
MySocket clientSocket { };
MySocket clientUDPSocket { };
class NetApp : GuiApplication
{
void Main()
{
clientSocket.Connect("localhost", 1234);
clientUDPSocket.DatagramConnect("localhost", 1234);
myService.Start();
udpSocket.DatagramHost(1234);
while(true)
{
ProcessNetworkEvents();
WaitNetworkEvent();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment