CSC209H5 Lecture Notes - Lecture 11: Netcat, Socket A, Standard Streams

80 views3 pages

Document Summary

Csc209h5s - software programming and tools (winter 2018) You will write a simple version of a client called netcat. netcat must listen to both stdin (for input from the user) and the socket, so it needs select. Your program should take two command-line arguments, the ip address and port of the machine you want to connect to. It should open a socket and connect to the given address at the given port, and then simply echo the data back and forth. Whenever the user types something on the keyboard, the program sends this to the socket, and whenever information arrives on the socket, the program echoes this data to the user on standard output. You may assume each time you read data, it fits into a buffer of size maxsize. Set up and bind the socket address. // call this with argv[1] = address, argv[2] = port int main ( int argc, char **argv) { char buf[maxsize];

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents