tcpsend04.c 394 B

123456789101112131415161718192021222324
  1. #include "unp.h"
  2. int
  3. main(int argc, char **argv)
  4. {
  5. int sockfd;
  6. if (argc != 3)
  7. err_quit("usage: tcpsend04 <host> <port#>");
  8. sockfd = Tcp_connect(argv[1], argv[2]);
  9. Write(sockfd, "123", 3);
  10. printf("wrote 3 bytes of normal data\n");
  11. Send(sockfd, "4", 1, MSG_OOB);
  12. printf("wrote 1 byte of OOB data\n");
  13. Write(sockfd, "5", 1);
  14. printf("wrote 1 byte of normal data\n");
  15. exit(0);
  16. }