File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Sockets and Internet Protocols and the fly likes Using New IO in heterogenous platform Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "Using New IO in heterogenous platform" Watch "Using New IO in heterogenous platform" New topic

Using New IO in heterogenous platform

Harshil Mehta
Ranch Hand

Joined: Mar 17, 2005
Posts: 64
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.

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

Joined: Oct 29, 2001
Posts: 9189

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.

[How To Ask Questions On JavaRanch]
I agree. Here's the link:
subject: Using New IO in heterogenous platform
It's not a secret anymore!