Changeset 0f88a225
- Timestamp:
- Dec 3, 2020, 3:19:37 PM (4 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 27b1ca1, aeb31b1
- Parents:
- fe9468e2
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
example/io/simple/server.cfa
rfe9468e2 r0f88a225 13 13 #include <time.hfa> 14 14 #include <thread.hfa> 15 #include <concurrency/iofwd.hfa> 15 16 16 17 //---------- … … 21 22 } 22 23 23 void message( Printer & mutex, char * msg, size_t len ) {24 fprintf(stderr, "'%.*s'", len, msg);24 void message( Printer & mutex, char * _msg, size_t len ) { 25 fprintf(stderr, "'%.*s'", len, _msg); 25 26 } 26 27 … … 29 30 } 30 31 31 void error( Printer & mutex, const char * msg, int error) {32 fprintf(stderr, "%s - %s\n", msg, strerror(error));32 void error( Printer & mutex, const char * _msg, int error) { 33 fprintf(stderr, "%s - %s\n", _msg, strerror(error)); 33 34 } 34 35 … … 49 50 } 50 51 } 51 52 //----------53 extern ssize_t cfa_recvmsg(int sockfd, struct msghdr *msg, int flags);54 extern int cfa_accept4(int sockfd, struct sockaddr *addr, socklen_t *addrlen, int flags);55 extern int cfa_close(int fd);56 52 57 53 //---------- … … 88 84 struct sockaddr_in cli_addr; 89 85 __socklen_t clilen = sizeof(cli_addr); 90 int newsock = cfa_accept4(sock, (struct sockaddr *) &cli_addr, &clilen, 0 );86 int newsock = cfa_accept4(sock, (struct sockaddr *) &cli_addr, &clilen, 0, 0, -1`s, 0p, 0p); 91 87 if (newsock < 0) { 92 88 error( printer, "accept", -newsock); … … 97 93 98 94 while(1) { 99 int res = cfa_recvmsg(newsock, &msg, 0 );95 int res = cfa_recvmsg(newsock, &msg, 0, 0, -1`s, 0p, 0p); 100 96 if(res == 0) break; 101 97 if(res < 0) { … … 107 103 } 108 104 109 ret = cfa_close(newsock );105 ret = cfa_close(newsock, 0, -1`s, 0p, 0p); 110 106 if(ret < 0) { 111 107 error( printer, "close new", -ret); … … 113 109 } 114 110 115 ret = cfa_close(sock );111 ret = cfa_close(sock, 0, -1`s, 0p, 0p); 116 112 if(ret < 0) { 117 113 error( printer, "close old", -ret);
Note: See TracChangeset
for help on using the changeset viewer.