tcpsend06.c 533 B

123456789101112131415161718192021222324252627282930
  1. #include "unp.h"
  2. int
  3. main(int argc, char **argv)
  4. {
  5. int sockfd;
  6. if (argc != 3)
  7. err_quit("usage: tcpsend06 <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. Send(sockfd, "6", 1, MSG_OOB);
  16. printf("wrote 1 byte of OOB data\n");
  17. Write(sockfd, "7", 1);
  18. printf("wrote 1 byte of normal data\n");
  19. exit(0);
  20. }