Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Socket problem

 
Nikolai Ivanov
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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()".
 
Nikolai Ivanov
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For binary data you can't use Readers and Writers at all - just Streams.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic