From this reasoning we conclude a the case labels in

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: *********************** * Sockets interface wrappers ****************************/ int Socket(int domain, int type, int protocol) { int rc; if ((rc = socket(domain, type, protocol)) < 0) unix_error("Socket error"); return rc; } void Setsockopt(int s, int level, int optname, const void *optval, int optlen) { int rc; if ((rc = setsockopt(s, level, optname, optval, optlen)) < 0) unix_error("Setsockopt error"); } void Bind(int sockfd, struct sockaddr *my_addr, int addrlen) { 684 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 APPENDIX A. ERROR HANDLING int rc; if ((rc = bind(sockfd, my_addr, addrlen)) < 0) unix_error("Bind error"); } void Listen(int s, int backlog) { int rc; if ((rc = listen(s, backlog)) < 0) unix_error("Listen error"); } int Accept(int s, struct sockaddr *addr, int *addrle...
View Full Document

Ask a homework question - tutors are online