Skip to content
Advertisement

UDP communication between Java and C#

I’m trying to communicate a Java program with a C# one but it’s not working.

The code is really basic, here it is:

This is the Java client

JavaScript

And here it is the C# server

JavaScript

The c# server is a Unity file, I mean, I execute it from Unity, so Start is the first method called.

I would like them to communicate through port 10000 (or any ohter one) in my computer, java’s main and c#’s start seem to be executed but the callback is never called.

Any ideas of why it isn’t working? Thank you all.

Advertisement

Answer

I’ve solved it, in the Java client new DatagramSocket() must be called without any argument, and in the c# server new UdpClient(port); must be called only with the port.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement