<div>So I went through the trouble of creating test code for this aspect and it came out clean. So I guess there's something else getting messed up along the way.</div>
<div>Rick<br><br> </div>
<div><span class="gmail_quote">On 9/22/07, <b class="gmail_sendername">Richard Schmidt</b> <<a href="mailto:huntingtonsurfca@gmail.com">huntingtonsurfca@gmail.com</a>> wrote:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<div>The sockaddr_in struct doesn't like to be modified via a pointer.</div>
<div> </div>
<div>I'm trying to modularize my code but this is preventing me from doing so.</div>
<div> </div>
<div>prototype: char *clientParse(char*buff, struct sockaddr_in *serv, ...)</div>
<div>and calling it: sBuff = clientParse(inBuff, &serv_addr, &my_addr);</div>
<div> </div>
<div>I dereference the pointer in the function like this:</div>
<div> </div>
<div>serv->sin_family = AF_INET;</div>
<div> </div>
<div>But when I try to bind the connection, using the serv_addr (in main), it fails.</div>
<div> </div>
<div>So I tried making local variables (in the function) and then:</div>
<div> </div>
<div>memcpy(serv, &servAddr, sizeof(struct sockaddr_in)); (in function)</div>
<div> </div>
<div>but this is still failing. Anyone else have an idea? I know this is the reason why it is failing because I've had this problem before with it and I found a workaround using memcpy() but that was in the same scope. I guess that's why it didn't work across function calls.
</div>
<div> </div>
<div>Any ideas?</div>
<div>Rick</div></blockquote></div><br>