I would like to send and receive custom objects and delegate the receive to a function on the server side. I have only got typed objects to work e.g <string>. I wont a single function to handle all types of incoming objects.
Server side:
private void Form_Load(object sender, EventArgs e)
{
NetworkComms.AppendGlobalIncomingPacketHandler<object>(“CLIENT_MESSAGE”,IncomingMessage);
TCPConnection.StartListening(newIPEndPoint(IPAddress.Parse(localIPAddress()), 54321));
}
private void IncomingMessage(PacketHeader header, Connection connection, object message)
{
do somthing with message…
string test = (string)message;
}
Client side:
private void Logon()
{
connection = TCPConnection.GetConnection(newConnectionInfo(ServerIP.ToString(), ServerPort));
connection.SendReceiveObject<object>(“CLIENT_MESSAGE”, ServerIP.ToString(), ServerPort, “LOGON”);
}