Initial commit of files

This commit is contained in:
2021-01-22 10:16:20 -05:00
parent 32d165ec8f
commit ed92211680
534 changed files with 68563 additions and 19 deletions

25
src/libnet/tcp_recv.c Normal file
View File

@ -0,0 +1,25 @@
//
// TCP recv
//
#include "netlib.h"
int tcp_recv( int sock, void *buf, int len )
{
char *s = (char *)buf;
size_t n;
/* check! */
if ( sock < 0 )
return -1;
if ( !buf || len <= 0 )
return -1;
/* read */
n = recv( sock, buf, len, 0 );
if ( n > 0 )
*(s+n) = '\0';
return n;
}