View Single Post
Ingram
Veteran Member
Join Date: May 2004
Old 03-16-2009 , 03:09   Re: Module: Sockets_hz ( listenning + nonblocking ) ... working :)
Reply With Quote #23

Well this message box is very very small, so sorry if what I post is hard to read.

I have found that this module seems to give me additional characters. For example 1fda. I don't know if anyone else has noticed this.

Anyway, I was looking at the souce for the reason why.
tmpchar[tmp]='\0'
while(max--&&nlen<tmp)
If tmp is the recieved length, why wouldn't the null byte be put at tmp + 1? As well if tmp is already the length, what is the purpose of max? And shouldn't nlen go until tmp and not less than tmp? (Or tmp+1 provided the case above is correct). If the null byte isn't copied, the string wouldn't terminate explaining the extra characters.

I really don't have the time to try and test this... I didn't even have much time to read over the code, so I was hoping someone who knew the code could help more.
Ingram is offline