Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Using New IO in heterogenous platform

 
Harshil Mehta
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I am facing problem for following situation,

my client is in perl and server is in Java.

the client sends us-ascii encoded data and server reads it and processes it.

the server used selector based multiplexing for doing the job.
it is as follow.

forever
selector.select()
some channel is interested so get channel
if channel is acceptable
accept it and register it with selector with
read/write operations
if channel is readable
read it into byte buffer
if channel is writable
write a bytebuffer into it
end forever

now my perl client just tries to open a Socket and send data. It does not try to receive anything. My server accpets connection, reads data and also tries to write data on channel.

how is it possible as perl client does not try to read from the socket.

can anyone please make it clear?

thanks in advance.
 
Joe Ess
Bartender
Posts: 9280
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Harshil Mehta:

how is it possible as perl client does not try to read from the socket.

Your question appears to be "how can my server receive data if my perl client does not read the reply?"
The answer to that question would be that the server receiving the data is not dependent on the client reading it. A socket is just a transport mechanism. It doesn't care what the protocol (standard for data exchange) is. It carries what you tell it to from one end to the other. If the other end isn't listening, the data vanishes when the sockets close. No harm done. Now if you were violating the protocol (i.e. having the client read before sending data) you'd have a problem.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic