Question:
Is it possible to send data with Java over TCP and receive that data with a C# server?
Akim
2012-02-28 01:12:28 UTC
For instance 2 computers on the same network, one has a Java client that outputs a string converted to bytes through an OutputStream (using port for example 4444), then the C# server would receive those bytes (from the same port 4444) and turn them into a string again and display whatever was sent from the client side. I already know how to do this with a Java client and server, I was just wondering if C# and Java can interact that easily. And I'm talking about standard native Java libraries and the same goes for C#.

Thanks in advance.
Four answers:
Motorhead
2012-02-28 22:08:56 UTC
The client and server have no concern over what language each other use at all.

The routing and data transfer is done entirely by IIS on Windows and Apache on Linux.

The java running on the client sends an http data stream, and depending on if the server is Windows or Linux, it gets routed to the appropriate C#, ASP, PHP, Perl or some other CGI routine.

If the server is Windows, then the Java client will be communicating with C# routines.



Thinking about sockets is way too complex.

That is for programming languages.

C# and Java are not programming languages, but scripting languages interpreted at run time.

The actual programs are the sandbox interpreters that execute the C# or Java, and they already are doing all the low level socket programming.

You don't have to do any in C# or Java.
peteams
2012-02-28 10:24:13 UTC
Look at the System.Net.Sockets name space, specifically the classes TcpListener and TcpClient, the Socket class might be interesting as well.
gjmb1960
2012-02-29 10:19:29 UTC
yes its possible.

write in C# a socket listener program.

write in java a socket write program

and thats it.

C# doesnt need to bother about java and java doesnt need to bother about c#
Kasey C
2012-02-28 01:13:51 UTC
Yes, look up "sockets programming" on both.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...