In message <[EMAIL PROTECTED]>, Mark Himsley writes: > My basic question is: how do I stop commons/net from setting the TCP > push flag on the socket connection. > > I've looked through the source of WhoisClient, FingerClient, > SocketClient, SocketFactory, DefaultSocketFactory and as yet don't > have a clue why the push flag is set ant the query is fragmented.
I'm going to have to punt this to someone else (maybe you if you've got the interest/time) to fix and patch, but if the push flag is being set, it's being done automatically by the JVM's class library in native code. There's probably a call to OutputStream.flush() somewhere and the underlying native code is turning that into TCP push. Why that's happening in the middle of as small amount of data as occurs in a whois query, I don't know.
Yes, that is a good question. I am wondering if there is a bug somewhere which is forcing a flush() after the first byte of a DataOutputStream.writeBytes() call. I shall have to test this hypotheses at some stage (unless someone else can confirm/deny this problem) and also test with JVM 1.4.1_02.
What I have done to correct this problem is to apply the attached patch to (admittedly to the NET_1_0_0 tagged version of) commons/net. I'm not completely sure what the implications are for converting a DataOutputStream.writeBtyes(String) into a PrintStream.print(String), which is essentially what I have done. I can't immediately see a problem though.
Looking with snort at the data sent from the fwhois example commons/net source with this patch applied I can see that the request is sent in one packet - still with the push flag set, but I guess that's because of the output.flush() call in FingerClient.getInputStream().
=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
07/29-13:17:47.838544 62.49.203.77:1591 -> 216.40.33.170:43 TCP TTL:127 TOS:0x0 ID:11642 IpLen:20 DgmLen:50 DF ***AP*** Seq: 0xC9BCBD8C Ack: 0xDE3FD9B2 Win: 0xFAF0 TcpLen: 20 6D 64 73 68 2E 63 6F 6D 0D 0A mdsh.com..
=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
Thanks for your time.
daniel
-- Mark Himsley
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
