jian@kuhub.cc.ukans.edu (02/06/91)
Hi, I posted a message about I had troubles dealing with socket system in AIX 3.1 Now, I get help from IBM and my problem has been solved. It was my misunderstanding of socket system. I always thought that the socket communication is packet oriented. Attached is the message about why I had problem with the socket system in AIX 3.1. I am favorably impressed with IBM's services. Jian jian@kuhub.cc.ukans.edu ------------------------------------------------------------------------------ Jian, I've found the reason why you are seeing a problem in your program. The recv() system call returns the actual number of bytes placed in the buffer. This is NOT necessarily the size that you supplied (the Sun man page concurs). One of the recv() calls eventually returns a size less than your frame. Therefore the next recv() would return the last portion of the previous frame and the beginning of the next. I was able to make your program work by looping on the recv() until I got the whole frame. The reason the frame is fragmented is because the sender is much faster than the receiver (the sender loops and sends while the recevier has to check). TCP sees that the receiver is backed up so it throttles back. This causes the short packet. There is no "record" concept in TCP so your frame is broken up. I think this situation is aggravated in the 6000 because of the processor speed. I would suspect you could reproduce it on a Sun by having the receiver do a sleep(1) after each recv(). Hope all this makes sense! Let me know how things work out. Greg