Comments (3)
Could the issue beeing related to the Test execution? I tried your code with the current NuGet on .NET Core, resulting in following logs (See end of msg). Thus your code is working on my side. Please try to call your SetupServer/Client from a none-test related environment. If that also doesn't work out, please check your firewall settings.
For further debugging, use connection.EnableLogging = true;
within your client/serverConnectionOk
method.
+-----------+---------------+-----------------+-----------------------------------------------------------------------+----------------------+
| Direction | Type | Local | ASCII | Packet |
+-----------+---------------+-----------------+-----------------------------------------------------------------------+----------------------+
| Outgoing | TcpConnection | 127.0.0.1:53722 | ?BConsoleApp1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null? | AddPacketTypeRequest |
+-----------+---------------+-----------------+-----------------------------------------------------------------------+----------------------+
+-----------+---------------+-----------------+-------------------+-----------------------+
| Direction | Type | Local | ASCII | Packet |
+-----------+---------------+-----------------+-------------------+-----------------------+
| Incoming | TcpConnection | 127.0.0.1:53722 | ���� ���tou���n? | AddPacketTypeResponse |
+-----------+---------------+-----------------+-------------------+-----------------------+
+-----------+---------------+----------------+-----------------------------------------------------------------------+----------------------+
| Direction | Type | Local | ASCII | Packet |
+-----------+---------------+----------------+-----------------------------------------------------------------------+----------------------+
| Incoming | TcpConnection | 127.0.0.1:4444 | ?BConsoleApp1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null? | AddPacketTypeRequest |
+-----------+---------------+----------------+-----------------------------------------------------------------------+----------------------+
+-----------+---------------+-----------------+-------+---------------------+
| Direction | Type | Local | ASCII | Packet |
+-----------+---------------+-----------------+-------+---------------------+
| Outgoing | TcpConnection | 127.0.0.1:53722 | ????� | EstablishUdpRequest |
+-----------+---------------+-----------------+-------+---------------------+
+-----------+---------------+----------------+-------------------+-----------------------+
| Direction | Type | Local | ASCII | Packet |
+-----------+---------------+----------------+-------------------+-----------------------+
| Outgoing | TcpConnection | 127.0.0.1:4444 | ���� ���tou���n? | AddPacketTypeResponse |
+-----------+---------------+----------------+-------------------+-----------------------+
+-----------+---------------+----------------+-------+---------------------+
| Direction | Type | Local | ASCII | Packet |
+-----------+---------------+----------------+-------+---------------------+
| Incoming | TcpConnection | 127.0.0.1:4444 | ????� | EstablishUdpRequest |
+-----------+---------------+----------------+-------+---------------------+
+-----------+---------------+-----------------+-------+--------------------+
| Direction | Type | Local | ASCII | Packet |
+-----------+---------------+-----------------+-------+--------------------+
| Outgoing | TcpConnection | 127.0.0.1:53722 | ???� | CalculationRequest |
+-----------+---------------+-----------------+-------+--------------------+
+-----------+---------------+----------------+-------+--------------------+
| Direction | Type | Local | ASCII | Packet |
+-----------+---------------+----------------+-------+--------------------+
| Incoming | TcpConnection | 127.0.0.1:4444 | ???� | CalculationRequest |
+-----------+---------------+----------------+-------+--------------------+
+-----------+---------------+----------------+-------+----------------------+
| Direction | Type | Local | ASCII | Packet |
+-----------+---------------+----------------+-------+----------------------+
| Outgoing | TcpConnection | 127.0.0.1:4444 | ????� | EstablishUdpResponse |
+-----------+---------------+----------------+-------+----------------------+
+-----------+---------------+-----------------+-------+----------------------+
| Direction | Type | Local | ASCII | Packet |
+-----------+---------------+-----------------+-------+----------------------+
| Incoming | TcpConnection | 127.0.0.1:53722 | ????� | EstablishUdpResponse |
+-----------+---------------+-----------------+-------+----------------------+
+-----------+---------------+-----------------+-------+-------------------------+
| Direction | Type | Local | ASCII | Packet |
+-----------+---------------+-----------------+-------+-------------------------+
| Outgoing | TcpConnection | 127.0.0.1:53722 | ? | EstablishUdpResponseACK |
+-----------+---------------+-----------------+-------+-------------------------+
+-----------+---------------+----------------+-------+-------------------------+
| Direction | Type | Local | ASCII | Packet |
+-----------+---------------+----------------+-------+-------------------------+
| Incoming | TcpConnection | 127.0.0.1:4444 | ? | EstablishUdpResponseACK |
+-----------+---------------+----------------+-------+-------------------------+
+-----------+---------------+----------------+-------+---------------------+
| Direction | Type | Local | ASCII | Packet |
+-----------+---------------+----------------+-------+---------------------+
| Outgoing | TcpConnection | 127.0.0.1:4444 | ?�?� | CalculationResponse |
+-----------+---------------+----------------+-------+---------------------+
+-----------+---------------+-----------------+-------+---------------------+
| Direction | Type | Local | ASCII | Packet |
+-----------+---------------+-----------------+-------+---------------------+
| Incoming | TcpConnection | 127.0.0.1:53722 | ?�?� | CalculationResponse |
+-----------+---------------+-----------------+-------+---------------------+
+-----------+---------------+-----------------+-----------------------------------------------------------------------+----------------------+
| Direction | Type | Local | ASCII | Packet |
+-----------+---------------+-----------------+-----------------------------------------------------------------------+----------------------+
| Outgoing | UdpConnection | 127.0.0.1:53723 | ?BConsoleApp1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null? | AddPacketTypeRequest |
+-----------+---------------+-----------------+-----------------------------------------------------------------------+----------------------+
+-----------+---------------+-----------------+-----------------------------------------------------------------------+----------------------+
| Direction | Type | Local | ASCII | Packet |
+-----------+---------------+-----------------+-----------------------------------------------------------------------+----------------------+
| Incoming | UdpConnection | 127.0.0.1:53724 | ?BConsoleApp1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null? | AddPacketTypeRequest |
+-----------+---------------+-----------------+-----------------------------------------------------------------------+----------------------+
+-----------+---------------+-----------------+-------------------+-----------------------+
| Direction | Type | Local | ASCII | Packet |
+-----------+---------------+-----------------+-------------------+-----------------------+
| Outgoing | UdpConnection | 127.0.0.1:53724 | ���� ���tou���n? | AddPacketTypeResponse |
+-----------+---------------+-----------------+-------------------+-----------------------+
+-----------+---------------+-----------------+-------------------+-----------------------+
| Direction | Type | Local | ASCII | Packet |
+-----------+---------------+-----------------+-------------------+-----------------------+
| Incoming | UdpConnection | 127.0.0.1:53723 | ���� ���tou���n? | AddPacketTypeResponse |
+-----------+---------------+-----------------+-------------------+-----------------------+
+-----------+---------------+-----------------+-------+--------------------+
| Direction | Type | Local | ASCII | Packet |
+-----------+---------------+-----------------+-------+--------------------+
| Outgoing | UdpConnection | 127.0.0.1:53723 | ???� | CalculationRequest |
+-----------+---------------+-----------------+-------+--------------------+
+-----------+---------------+-----------------+-------+--------------------+
| Direction | Type | Local | ASCII | Packet |
+-----------+---------------+-----------------+-------+--------------------+
| Incoming | UdpConnection | 127.0.0.1:53724 | ???� | CalculationRequest |
+-----------+---------------+-----------------+-------+--------------------+
+-----------+---------------+-----------------+-------+---------------------+
| Direction | Type | Local | ASCII | Packet |
+-----------+---------------+-----------------+-------+---------------------+
| Outgoing | UdpConnection | 127.0.0.1:53724 | ?�?� | CalculationResponse |
+-----------+---------------+-----------------+-------+---------------------+
+-----------+---------------+-----------------+-------+---------------------+
| Direction | Type | Local | ASCII | Packet |
+-----------+---------------+-----------------+-------+---------------------+
| Incoming | UdpConnection | 127.0.0.1:53723 | ?�?� | CalculationResponse |
+-----------+---------------+-----------------+-------+---------------------+
from network.
Hi
Thanks alot for your response.
Indeed inside NUnit tests i was having this issue, where running in a simple console app i dont. Awkward i dont know why, will investigate and let you know.
Something interesting you can also see when u ran the code, is that the CalculationRequest is being sent twice, as the client connection is being accepted twice for some reason. It happens both for UDP and TCP. Is that part of the handshake proccess thats why its called twice ?
Again thanks alot for the answer. Im digging down this lib as it seems to fit nicely a mmo project we writing.
from network.
Glad I could be of any help.
Something interesting you can also see when u ran the code, is that the CalculationRequest is being sent twice, as the client connection is being accepted twice for some reason. It happens both for UDP and TCP. Is that part of the handshake proccess thats why its called twice ?
Within your clientConectionOk
implementation you not only register, but also send a CalculationRequest right away. The method clientConectionOk
will be called for TCP and UDP; thus the second parameter ConnectionType
tells you what kind of connection you received. Nevertheless you execute the Send
for TCP/UDP.
from network.
Related Issues (20)
- Crashing if variables on connection event.
- Static strings cause crashes
- WritePacketThreadException with Unity build on android HOT 9
- Problem when sending a packet from server to client HOT 5
- Can this library send and receive structs ? HOT 2
- Calling ServerConnectionContainer.Stop or ServerConnectionContainer.StopTcpListener() Throws an Exception HOT 1
- Cannot communicate withe IPv4 address HOT 4
- Using Network with mono HOT 4
- A Task was cancelled HOT 7
- license usage within closed source commercial game HOT 1
- not sure what i'm missing when using the registerstaticpacket handler HOT 1
- Connection closes with the reason "AssemblyDoesNotExist" after sending custom packets
- AssemblyDoesNotExist when sending strings HOT 2
- Unnecessary dependency Microsoft.CSharp HOT 1
- System.IO.EndOfStreamException: 'Unable to read beyond the end of the stream.' HOT 1
- Classes in packets get instantiated as the parent variable Type rather than the Type they were initially when being sent
- Connection closed event not raised when connection times out
- Packet handler in Client is not called after reconnecting
- possible infinite loop problem at runtime HOT 1
- Structs are unsupported
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from network.