From: Nathan Taylor Date: 2006-12-30T04:28:09+09:00 Subject: Re: how to properly format data when using TCPSocket.send() Francis Cianfrocca wrote: > On 12/29/06, Nathan Taylor wrote: >> > Btw, why don't you use Net::HTTP? >> METHOD = 'PUT' >> >> > > I think you would do well to do some basic reading on HTTP. To > understand how headers work, you might even read RFC-822. HTTP doesn't > use multiple TCP connections (not in the sense of relating them to > each other, at any rate), and I don't know what you mean when you say > that it uses multiple TCP "sessions." I mean that a new TCP session is created for every HTTP request/response pair. For example if you were to send two different GET requests you would use two TCP sessions(3-way hand shake, and graceful close). However, rethinking the situation this should not be a problem for what I am trying to do. Even if the server responds with multiple response codes it should be ok since they would be transported via the same TCP session as the initial request sent from the client. Unfortunately the packets generated and sent out on the wire from my code does not seem to be waiting for the HTTP response data before it sends out a request for a graceful close of the TCP session. 03:27:40.315919 IP 127.0.0.1.51200 > 127.0.0.1.80: P 1:257(256) ack 1 win 257 0x0000: 4500 0134 529f 4000 4006 e922 7f00 0001 E..4R.@.@..".... 0x0010: 7f00 0001 c800 0050 5f61 2a67 5fe0 3c72 .......P_a*g_.S 0x00e0: 6565 2053 706f 7420 5275 6e21 3c2f 6865 ee.Spot.Run!See.Sp 0x0100: 6f74 2052 756e 213c 2f74 6974 6c65 3e3c ot.Run!< 0x0110: 626f 6479 3e53 6565 2053 706f 7420 5275 body>See.Spot.Ru 0x0120: 6e21 3c2f 626f 6479 3e3c 2f68 746d 6c3e n! 0x0130: 0d0a 0d0a .... 03:27:40.316702 IP 127.0.0.1.80 > 127.0.0.1.51200: . ack 257 win 265 0x0000: 4500 0034 4570 4000 4006 f751 7f00 0001 E..4Ep@.@..Q.... 0x0010: 7f00 0001 0050 c800 5fe0 3c72 5f61 2b67 .....P.._. 127.0.0.1.80: F 257:257(0) ack 1 win 257 0x0000: 4500 0034 52a0 4000 4006 ea21 7f00 0001 E..4R.@.@..!.... 0x0010: 7f00 0001 c800 0050 5f61 2b67 5fe0 3c72 .......P_a+g_. 127.0.0.1.51200: P 1:468(467) ack 258 win 265 0x0000: 4500 0207 4571 4000 4006 f57d 7f00 0001 E...Eq@.@..}.... 0x0010: 7f00 0001 0050 c800 5fe0 3c72 5f61 2b68 .....P.._.