tcpsend05.c 526 B

1234567891011121314151617181920212223242526272829
  1. #include "unp.h"
  2. int
  3. main(int argc, char **argv)
  4. {
  5. int sockfd, size;
  6. char buff[16384];
  7. if (argc != 3)
  8. err_quit("usage: tcpsend05 <host> <port#>");
  9. sockfd = Tcp_connect(argv[1], argv[2]);
  10. size = 32768;
  11. Setsockopt(sockfd, SOL_SOCKET, SO_SNDBUF, &size, sizeof(size));
  12. Write(sockfd, buff, 16384);
  13. printf("wrote 16384 bytes of normal data\n");
  14. sleep(5);
  15. Send(sockfd, "a", 1, MSG_OOB);
  16. printf("wrote 1 byte of OOB data\n");
  17. Write(sockfd, buff, 1024);
  18. printf("wrote 1024 bytes of normal data\n");
  19. exit(0);
  20. }