![]() Note that attempting to use a single FILE* to read from and write to a socket will not necessarily work. Then, use standard I/O functions such as fprintf, fgets, and fscanf to do I/O Solution: convert a file descriptor into a FILE * using the fdopen() function. ![]() Write - write data from a buffer to a file/stream named by a file descriptor ssize_t write ( int fd, const void * buf, size_t count ) Read - read data from a file/stream named by a file descriptor into a buffer ssize_t read ( int fd, void * buf, size_t count ) Windows has something almost identical, called “winsock” File descriptorsĪ file descriptor is an integer value naming an underlying open file resource.įile descriptors are used in all Unix system calls which do I/O, or other operations on files/streams. Sockets - the Unix standard API for network I/O CS 365: Lecture 15: Socket programming in C Unix I/O, Sockets
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |