willardf / Hazel-Networking

Hazel Networking is a low level networking library for C# providing connection-oriented, message-based communication via RUDP.
MIT License
391 stars 60 forks source link

[Question] What is correct implementation for communicating consoles in other networks? #41

Closed Noirand closed 2 years ago

Noirand commented 2 years ago

Hi,

First of all, is this the correct place to ask any questions? If not, tell me the other proper place and forgive please.

I'm working on online multiplay game (up to 4 people) and use Hazel to make P2P communication. I also use Unity.

I'm a newbie about network coding and I don't have confidence that this implementation is right... anyway, I did like below:

I made one console have both of UdpConnectionListener and UdpClientConnection. When host console makes a room via outer matchmake service (and get IP and port number etc.), host does ConnectAsync() to guest consoles. When host's ConnectAsync succeed, guests do ConnectAsync(). Then they can communicate each other.

The problem is: This implementation works right when all consoles are in the same network. However, when they are in different network, host's or guest's ConnectAsync() doesn't succeed. The status doesn't change "Connecting" to "Connected." (Curiously, the other side's ConnectAsync() succeeds.)

What should I do to fix this?

I'm sorry about my poor English. Thank you for any help.

Noirand commented 2 years ago

Hi,

I figured out there were some mistakes in my code, which occurred from my poor understanding about Socket and P2P communication.

I'm sorry for bothering you.