aspose file tools*
The moose likes Threads and Synchronization and the fly likes Java Socket buffering problem and nonblocking Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "Java Socket buffering problem and nonblocking" Watch "Java Socket buffering problem and nonblocking" New topic
Author

Java Socket buffering problem and nonblocking

Giridhar Yeldi
Greenhorn

Joined: Oct 19, 2008
Posts: 2
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

Joined: Oct 26, 2003
Posts: 420
    
    2

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.


"Eagles may soar but weasels don't get sucked into jet engines" SCJP 1.6, SCWCD 1.4, SCJD 1.5,SCBCD 5
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Java Socket buffering problem and nonblocking