• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Socket problem

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For binary data you can't use Readers and Writers at all - just Streams.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic