Last active
August 29, 2015 14:01
-
-
Save jerstlouis/0d162e7f65376f870fe8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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