[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [openss7] Getting through



Chuck,

The code still does not check how much data was returned
by recvmsg.  It may be returning 0.  It is not the correct
semantic to return 0 bytes read, but it would be worth
checking.  Recvmsg returning 0 would completely expain
the results.

(Linux TCP has some weird problems with regard to POSIX
compliance in recvmsg as well which could have carried
into the SCTP code.)

I would suggest:

Chuck Winters wrote:                             Tue, 12 Jun 2001 18:57:27

[snip]
> 
> 	/** Now read from the socket **/
> 	for(ct = 0; ct < 100; ct++)
> 	{
                int bytes;
  		if( (bytes = recvmsg(connect_sock, &message, MSG_WAITALL | MSG_NOSIGNAL)) < 0)
> 		{
> 			perror("Reading");
> 			exit(1);
> 		}
> 
> 		fprintf(stderr, "Client Addres is %s\n", message.msg_name);
                fprintf(stderr, "Read %d bytes\n", bytes);
> 		fprintf(stderr, "%d) Data received is  %s\n", ct, message.msg_iov->iov_base);
> 
> 		ioctl(connect_sock, FIONREAD, &buffsize);
> 		fprintf(stderr, "Data still in recv buffer is %d\n", buffsize);
> 		memset(buff, 0, 1024);
> 		fprintf(stderr, "buffsize %d\n", buffsize);
> 	}
[snip]


-- 
Brian F. G. Bidulock    ¦ The reasonable man adapts himself to the ¦
bidulock@openss7.org    ¦ world; the unreasonable one persists in  ¦
http://www.openss7.org/ ¦ trying  to adapt the  world  to himself. ¦
                        ¦ Therefore  all  progress  depends on the ¦
                        ¦ unreasonable man. -- George Bernard Shaw ¦