How to communicate with c# TcpListener (server) as a client?

Hi!

I'm trying to do a game wich is written in c# and I want to force this game to coexistence with a Processing application and communicate with it. So the default stage is --> C# server read and write data too to the client : Processing.Net OR java.net (I have tried both) read and write data too but don't blocking the Processing main thread because I need the draw method in Processing too.

So as I write here I have already tried processing.net.client to connect to the C# TcpListener but I think this is just not possible? And now I can connect to the server with java.net.Socket but when I trying to write a message in C# to the Processing the C# says to me how the Processing is forced the socket to close.. So I can't send data to it.. (The threading is created with the Processing thread("...") method)

M. Márkó (MDEV) , Hungary

Answers

  • Answer ✓

    You should attempt your approach using the oscP5 library. You will need to setup a TCP connection as the standard is to establish a UDP connection. However, I don't think it will work straight out of the box for reading incoming traffic as I believe the oscP5 library is expecting a package with certain format. However, if you are able to establish a connection, you should be able to send data and receive and parse that data in your server side.

    I haven't run much C# code. If you share a short running script I can try to implement a short test code on my side in the next few days ( or more like this weekend)

    No comments about Processing.net or java.net.... Maybe check if any of the examples in this next page could help you: http://happycoding.io/tutorials/java-server/ (@KevinWorkman)

    Kf

  • Thanks for your response.

    I will take a look at oscP5.

    Here is my C# TcpListener Here is my Processing client

    Thanks, Márkó

  • edited August 2017

    PS.: I think the OSC message format wont be a problem. "They" did OSC to C# too. (In NuGet package manager Rug.Osc)

  • Great to hear. Thxs for sharing your answer.

    Kf

Sign In or Register to comment.