hy people
i try to write something like a portmapper
the code is mostly from example code
it works as following:
1. an NIOProxy object is created
2. the constructor connects to tcp addresses
3. it sends a connection
string with a sessionid to one of the 2 hosts
4. it creates 2 threads both just reading data and forward it to the other socket
the problem i have:
the portmapper above is a workaround for some firewall rules on the remote host
everything works great, but after some bytes of data (i think it may be around 2kb) it get's stuck
the two apps which want to communicate through this port mapper, send some data to each other
what i think the problem is:
my question is, if nio sockets buffer data internally?
cause i think i read and write the data correctly, BUT the data isn't sent if it was too few data to send
so is it possible to flush() the sockets?
maybe the code is not right?
the interesting thing about it is, none of the connections get closed
it seems that both applications (local and remote) are waiting for some data
and i think the data hangs in an internal buffer in the socket api
but that's hard to verify
but maybe i got the threads wrong? can there be a problem in my code?
the output looks like this:
Server Found
Server Found
i got 264bytes something from remote.host/192.168.11.61:23453 to localhost/127.0.0.1:10001
i got 422bytes something from localhost/127.0.0.1:10001 to remote.host/192.168.11.61:23453
i got 1232bytes something from remote.host/192.168.11.61:23453 to localhost/127.0.0.1:10001
i got 486bytes something from localhost/127.0.0.1:10001 to remote.host/192.168.11.61:23453
i got 1264bytes something from remote.host/192.168.11.61:23453 to localhost/127.0.0.1:10001
i got 3624bytes something from remote.host/192.168.11.61:23453 to localhost/127.0.0.1:10001
i got 502bytes something from localhost/127.0.0.1:10001 to remote.host/192.168.11.61:23453
i got 4120bytes something from remote.host/192.168.11.61:23453 to localhost/127.0.0.1:10001
many thanks
[ October 23, 2006: Message edited by: Jonathan Doe ]
[EDIT: altered code and striped output]
[...and I inserted some line breaks into the print statement, so it doesn't force the whole window to be unnecessarily wide - Jim]
[ October 23, 2006: Message edited by: Jim Yingst ]