Win a copy of Head First Agile this week in the Agile forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Java to C++ sockets TCP/IP  RSS feed

 
Amit A. Patil
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a Java program communicating with C++ over sockets (Cant help it).
I am using InputStream to read bytes from Java.In C++ i send data to Java
using send.
The trouble is data is corrrectly recived but (-1) End of stream is not indicated.
How to do it from C++?if i use send sending -1 java thinks of it as data

Thanks
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you want Java to see end-of-stream, then you have to end the stream -- i.e., close it. If you close the socket on the C++ end, Java will know about it the next time it tries to read.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!