Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java Socket buffering problem and nonblocking

 
Giridhar Yeldi
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Im a fresher, i dnt have experience in java
Currently im handling one project wchich is device based implementing in java(USING TCP/IP socket).

Simultaneously i wan't send commands to the device.

But while implementing concept with nonblocking socket(SocketChannel) im not receiving complete packets from that device or sometimes receiving but it returns proper values with some extra characters.

I don't know how to handle buffering for socket which im receiving from device (the deivce can return any no. of bytes at a time).


But device working system like this if i will send command to device it sends complete information.

How to implement properly can anyone help me.....
 
Chris Hurst
Ranch Hand
Posts: 443
3
C++ Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is probably not the best forum for a Java socket problem ;-)

... when doing socket stuff I now always find an appropriate framework and use that, rather than do the really low level stuff myself as there are far better experts at such things.

Why not search the net for an open source framework there are several what about ApacheMina (plenty of others), get it working in that if you can't use open source for whatever reason, their source code is freely available and usually well written to give you some tips as to where your going wrong.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic