S2S Communication
There is no way to create a connection between the servers. Alternatively, i can use a separate client on the server side, but it would mean the allocation of the new open port. Do you think this is a good solution ? NetClient сontains a realization of P2P why not do the same for NetServer ?
Connection between servers is very rare task. But if you need this feature i will think about it :). Maybe i will merge NetClient and NetServer in one class.
@RevenantX I think this is worth considering. Implement at peer to peer. You have a very similar framework on lidgren. There NetPeer implements all the communication as one-to-many. But I liked most of your implementation.
Don't know if it is related but, in my game, i will need to send and receiva data via udp, so client and server must use something like:
server = new NetServer(this, 100, connectionKey);
server.DiscoveryEnabled = true;
server.DisconnectTimeout = 5 * 60 * 1000;
server.Start(port);
?
Or there is another way? when i put my server to a cloud hosting (like amazon ec2), would it connect successful to a client in a personal computer too?
Don't know if it is related but, in my game, i will need to send and receive data via udp
I don't fully understand what you mean. This library uses UDP (with reliable protocol over it) for communication.
when i put my server to a cloud hosting (like amazon ec2), would it connect successful to a client in a personal computer too?
Clients must connect to server - because they can be behind the NAT
server.DisconnectTimeout = 5 * 60 * 1000;
don't use such big timeout. Library automaticaly sends KeepAlive packets. Keep timeout in range 5 - 10 seconds ( 5000 - 10000 msec )
yes, my client connect to server, but how can my server send message to my clients too? Say my client1 sends movement message with x & y to server. How i make the server send those positions to the other clients? Right now, i started the client too as a server, so i can message between them, but i guess thats not correct
@jradesenv look at unity3d example. It very simple. Server can send messages to any client and to all clients. You can get all connected clients on server by calling server.GetPeers(). And then use peer.SendMessage(...)
Nice haha easy as replace NetServer by NetClient on my client hehe thanks!!!
Done (https://github.com/RevenantX/LiteNetLib/commit/9c3da93c14b3cd2b80dfdcd6fd945e389da1500e and next 5 commits)