• 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

No Data - Socket

 
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello everyone. I'm trying to write a client socket that connects to a mainframe. This is the first time I've used sockets, so I'm definitely green on this.

Bottom line, when I connect to the server, the cursor just blinks, waiting for data. I've tried Google searches and found some good resources, but didn't find the exact answer to my question. So, naturally, I came here!

Here is my code: For security reasons, I'm not putting the actual IP address.


Thanks!!
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Using BufferedReader.readLine() is a Bad Idea with sockets because different platforms use different end-of-line markers.
 
Claude Cundiff
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Joe,

That makes a lot of sense. However, what I don't understand is what is the alternative to input. The article
addressed output only. I have no control over what the server sends me.

Do I have to send something to the server before I get a response?

Thanks!!
 
Joe Ess
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Claude Cundiff:
Do I have to send something to the server before I get a response?



That's determined by the communication protocol the server uses.

Why don't you try just reading bytes from the server to begin with? Once you've established you can get output, you can refine how you process that information.
 
reply
    Bookmark Topic Watch Topic
  • New Topic