Advertisement
Guest User

Untitled

a guest
Aug 28th, 2016
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. jgor@ubuntu-lab:~$ cat name.c
  2. #include <stdio.h>
  3.  
  4. int main() {
  5. char buf[32];
  6.  
  7. printf("input your name:\n");
  8. scanf("%s", buf);
  9. printf("your name is %s\n", buf);
  10.  
  11. return 0;
  12. }
  13.  
  14. jgor@ubuntu-lab:~$ gcc -o name name.c
  15. jgor@ubuntu-lab:~$
  16. jgor@ubuntu-lab:~$
  17. jgor@ubuntu-lab:~$ ./name
  18. input your name:
  19. foo
  20. your name is foo
  21. jgor@ubuntu-lab:~$
  22. jgor@ubuntu-lab:~$
  23. jgor@ubuntu-lab:~$ echo foo | ./name
  24. input your name:
  25. your name is foo
  26. jgor@ubuntu-lab:~$
  27. jgor@ubuntu-lab:~$
  28. jgor@ubuntu-lab:~$ socat TCP-LISTEN:1337,fork,reuseaddr EXEC:"./name" &
  29. [1] 8877
  30. jgor@ubuntu-lab:~$ nc 127.0.0.1 1337
  31. foo
  32. input your name:
  33. your name is foo
  34. jgor@ubuntu-lab:~$
  35. jgor@ubuntu-lab:~$
  36. jgor@ubuntu-lab:~$ echo foo | nc 127.0.0.1 1337
  37. jgor@ubuntu-lab:~$
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement