Hello, I use this library for interaction between two progarams on one machine. Library doesn't work if i don't have an internet connection on a computer.
I get exception in NetPeer.Internal.cs line 179
byte[] combined = new byte[epBytes.Length + macBytes.Length];
macBytes is null, because library can't get mac address bytes.
Library try to get NetworkInterface in PlatformWin32.cs line 26 and Windows return Loopback interface. So, GetNetworkInterface() return null and I will get exception.
Can I use this library for local network messaging without internet connection?
It is some my code for initialization:
// declare variables in class
private NetServer _server;
private NetPeerConfiguration _serverConfig;
public LocalNetworkServer()
{
// needed for RegisterReceivedCallback, TODO replace with AsyncOperationM...
if (SynchronizationContext.Current == null)
SynchronizationContext.SetSynchronizationContext(new SynchronizationContext());
_serverConfig = new NetPeerConfiguration("AdrenalineGame");
_serverConfig.Port = 45045;
_serverConfig.MaximumConnections = 10;
_serverConfig.ConnectionTimeout = 10;
_serverConfig.PingInterval = 3;
}
public void Start()
{
_server = new NetServer(_serverConfig);
_server.RegisterReceivedCallback(new System.Threading.SendOrPostCallback(ReceiveDataCallback));
_server.Start();
}