254 |
the supplied memory pointer mem */ |
the supplied memory pointer mem */ |
255 |
netbuf_copy_partial(buf, mem, copylen, sock->lastoffset); |
netbuf_copy_partial(buf, mem, copylen, sock->lastoffset); |
256 |
|
|
257 |
|
/* Check to see from where the data was. */ |
258 |
|
if(from != NULL && fromlen != NULL) { |
259 |
|
addr = netbuf_fromaddr(buf); |
260 |
|
port = netbuf_fromport(buf); |
261 |
|
((struct sockaddr_in *)from)->sin_addr.s_addr = addr->addr; |
262 |
|
((struct sockaddr_in *)from)->sin_port = port; |
263 |
|
((struct sockaddr_in *)from)->sin_family = AF_INET; |
264 |
|
*fromlen = sizeof(struct sockaddr_in); |
265 |
|
} |
266 |
|
|
267 |
/* If this is a TCP socket, check if there is data left in the |
/* If this is a TCP socket, check if there is data left in the |
268 |
buffer. If so, it should be saved in the sock structure for next |
buffer. If so, it should be saved in the sock structure for next |
269 |
time around. */ |
time around. */ |
276 |
netbuf_delete(buf); |
netbuf_delete(buf); |
277 |
} |
} |
278 |
|
|
279 |
/* Check to see from where the data was. */ |
|
|
if(from != NULL && fromlen != NULL) { |
|
|
addr = netbuf_fromaddr(buf); |
|
|
port = netbuf_fromport(buf); |
|
|
((struct sockaddr_in *)from)->sin_addr.s_addr = addr->addr; |
|
|
((struct sockaddr_in *)from)->sin_port = port; |
|
|
((struct sockaddr_in *)from)->sin_family = AF_INET; |
|
|
*fromlen = sizeof(struct sockaddr_in); |
|
|
} |
|
|
|
|
280 |
return copylen; |
return copylen; |
281 |
} |
} |
282 |
/*-----------------------------------------------------------------------------------*/ |
/*-----------------------------------------------------------------------------------*/ |