<div>The sockaddr_in struct doesn&#39;t like to be modified via a pointer.</div>
<div>&nbsp;</div>
<div>I&#39;m trying to modularize my code but this is preventing me from doing so.</div>
<div>&nbsp;</div>
<div>prototype: char *clientParse(char*buff, struct sockaddr_in *serv, ...)</div>
<div>and calling it: sBuff = clientParse(inBuff, &amp;serv_addr, &amp;my_addr);</div>
<div>&nbsp;</div>
<div>I dereference the pointer in the function like this:</div>
<div>&nbsp;</div>
<div>serv-&gt;sin_family = AF_INET;</div>
<div>&nbsp;</div>
<div>But when I try to bind the connection, using the serv_addr (in main), it fails.</div>
<div>&nbsp;</div>
<div>So I tried making local variables (in the function) and then:</div>
<div>&nbsp;</div>
<div>memcpy(serv, &amp;servAddr, sizeof(struct sockaddr_in)); (in function)</div>
<div>&nbsp;</div>
<div>but this is still failing. Anyone else have an idea? I know this is the reason why it is failing because I&#39;ve had this problem before with it and I found a workaround using memcpy() but that was in the same scope. I guess that&#39;s why it didn&#39;t work across function calls.
</div>
<div>&nbsp;</div>
<div>Any ideas?</div>
<div>Rick</div>