Java How to send a binary stream from Java-client to C#-server via Tcp?

  • Thread starter user366312
  • Start date
24,303
5,989
Check the source code.
Checking the source code doesn't tell you that the client works in the real world. You have to run it, and you have to have some way of telling that it does the right thing when you run it. That's why we keep asking for something like a transcript of the console session when you actually run it.

Donald Knuth has a saying that is relevant here: "Beware of bugs in the above code; I have only proved it correct, not tried it."

 

user366312

Gold Member
62
2
That's why we keep asking for something like a transcript of the console session when you actually run it.
Which console? C# or Java?
 

Svein

Science Advisor
Insights Author
1,923
579
Why would he want to do that? He's not trying to transfer files.
Transferring a bit stream has the same inherent problems as transferring binary files. It is not dead easy - FTP has gone through several revisions.
 

user366312

Gold Member
62
2
Both the C# will show that it works and the Java one will show something else that may be key to your problem.
I have solved the problem. Never mind.

I thank all of you for your time and effort.
 

user366312

Gold Member
62
2
That's great!

So what was the problem?
There was difference in r/w data format.

I am now using raw data format on both ends. I am using bye arrays.
 
24,303
5,989
Transferring a bit stream has the same inherent problems as transferring binary files
It has some of the same inherent problems, yes. But those problems are lower level than the application/protocol level. At the application/protocol level, FTP is specialized for transferring files (which don't have to be binary, FTP has a text mode as well--not that I would recommend using it, but it has one :wink:). And actually it's not a very good protocol for transferring files, since it requires two TCP connections instead of one and coordination between the two connections (control and data) is clunky.
 
10,334
3,866
There was difference in r/w data format.

I am now using raw data format on both ends. I am using bye arrays.
If this work gets more involved then you might want to consider zeromq.

Its very popular for communications between disparate programs in a microservices environment, has several multi-program architectures depending on the problem, and you get extra capability that might prove useful in the future.
 

user366312

Gold Member
62
2
If this work gets more involved then you might want to consider zeromq.

Its very popular for communications between disparate programs in a microservices environment, has several multi-program architectures depending on the problem, and you get extra capability that might prove useful in the future.
ZeroMQ is good for professional solutions. I doing a semester project.
 

user366312

Gold Member
62
2
But you could put it on your resume sometimes these little things make a big difference.
Okay. Thanks for the advice. I will look into that.
 

Want to reply to this thread?

"How to send a binary stream from Java-client to C#-server via Tcp?" You must log in or register to reply here.

Physics Forums Values

We Value Quality
• Topics based on mainstream science
• Proper English grammar and spelling
We Value Civility
• Positive and compassionate attitudes
• Patience while debating
We Value Productivity
• Disciplined to remain on-topic
• Recognition of own weaknesses
• Solo and co-op problem solving
Top