fork(1) download
  1. #include <sys/socket.h>
  2.  
  3. const char* getIpProtocolId(int sock){
  4. int proto;
  5. socklen_t proto_len = sizeof(proto);
  6. int res = getsockopt(sock,SOL_SOCKET,SO_TYPE,
  7. &proto,&proto_len);
  8.  
  9. if ( res == 0 ) switch(proto){
  10. case SOCK_STREAM: return "tcp";
  11. case SOCK_DGRAM: return "udp";
  12. default: break;
  13. }
  14.  
  15. return "unknown";
  16. }
  17.  
  18.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
/usr/lib/gcc/i486-linux-gnu/4.8/../../../i386-linux-gnu/crt1.o: In function `_start':
(.text+0x18): undefined reference to `main'
collect2: error: ld returned 1 exit status
stdout
Standard output is empty