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

Socket problem

Nikolai Ivanov
Greenhorn

Joined: Dec 21, 2009
Posts: 4
Hi all,

First of all this is my first message inspite of i have been reading this forum for more than an year.

Here is my problem.

i want to get information from server that sends it every n-seconds.

i tried the tutorial from the official java documentation but nothing happened

here is a part of the code:



As i said the server is programmed to send data every n-seconds and i want to be able to capture this data and later manipulate.

When i try to connect to the server with the build in windows xp program called HyperTerminal it works like charm.

Any suggestions?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41865
    
  63
Welcome to (posting on) JavaRanch.

There may be other problems with the code, but one lingering bug is this one: Don't println to a Socket

I also suspect that "message == reader.readLine()" should be "message = reader.readLine()".


Ping & DNS - my free Android networking tools app
Nikolai Ivanov
Greenhorn

Joined: Dec 21, 2009
Posts: 4
Actually i didn't realize that what i need to get from the server is BINARY DATA NOT TEXT.

So if you guys know some trick to get binary data you are welcomed.

Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41865
    
  63
For binary data you can't use Readers and Writers at all - just Streams.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Socket problem