Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

No Data - Socket  RSS feed

 
Claude Cundiff
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • 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!!
 
Joe Ess
Bartender
Posts: 9425
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • 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
  • 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: 9425
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • 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.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!