02-16-2015, 12:12 AM
I'm thinking about UDP support. Since UDP doesn't have the concept of a persistent connection, I think the only interface needed would be an "Endpoint", which can be attached to a port number and either receive or send UDP datagrams.
The interface:
- cNetwork:CreateUDPEndpoint(Port, UDPCallbacks) -> cUDPEndpoint object
cUDPEndpoint methods:
- IsOpen()
- GetPort()
- Send(Data, Host, Port) - sends a datagram with the specified data payload to the specified host/port
- EnableBroadcasts() - enables the endpoint to send broadcasts (using special host/port combinations)
- Close()
UDPCallbacks:
- OnError(ErrorCode, ErrorMsg)
- OnReceivedData(Data, Host, Port) - A datagram with the specified Data payload has been received from the specified host/port
The interface:
- cNetwork:CreateUDPEndpoint(Port, UDPCallbacks) -> cUDPEndpoint object
cUDPEndpoint methods:
- IsOpen()
- GetPort()
- Send(Data, Host, Port) - sends a datagram with the specified data payload to the specified host/port
- EnableBroadcasts() - enables the endpoint to send broadcasts (using special host/port combinations)
- Close()
UDPCallbacks:
- OnError(ErrorCode, ErrorMsg)
- OnReceivedData(Data, Host, Port) - A datagram with the specified Data payload has been received from the specified host/port