|
|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T s
Length: 555 (0x22b)
Types: TextFile
Names: »sockio.c«
└─⟦b20c6495f⟧ Bits:30007238 EUUGD18: Wien-båndet, efterår 1987
└─⟦this⟧ »EUUGD18/General/Bj/sockio.c«
#include <stdio.h>
/*
* Routines to send and receive on sockets. Four bytes of length are
* sent, followed by the null terminated string.
*
*/
void sockread(s, buf)
int s; /* socket to talk on */
char *buf; /* string to send */
{
int nbytes;
(void) read(s, (char *) &nbytes, sizeof(int));
(void) read(s, buf, nbytes);
}
void sockwrite(s, buf)
int s; /* socket to talk on */
char *buf; /* string to read on */
{
int nbytes;
nbytes = strlen(buf) + 1;
(void) write(s, (char *) &nbytes, sizeof(int));
(void) write(s, buf, nbytes);
}