OpSys Fall 2005 - HW FAQ

Click on a question to expand it (for the details).
Click on the question title again to hide the details.

+ File permissions

Question:

When a file is transferred, the new file that is created might not have the same permissions as the original, is this OK?


Answer:

Yes, this is OK. There is no need to make sure file permissions match, just make sure the new file is readable by the owner.

+ What port was I assigned?

Question:

After calling bind() in the server, how do I find out what port number I've been assigned?


Answer:

You need to call getsockname (man getsockname for the details).

  len = sizeof(struct sockaddr);
  getsockname(ld,(struct sockaddr*)&skaddr,&len);
  printf("Port number assigned is %d\n",ntohs(skaddr.sin_port));

+ I'm lost...

Question:

I don't understand what an "application protocol" is, or how to get a server and client to talk to each other. The sample code tcpplay is confusing - the same program is both client and server, and all that they do is forward stuff, so there is no application protocol.


Answer:

There is a new sample client/server available here. This is a TCP based client and server, the server does user name lookups (give it a userid or login name and it will send back a user's full name).

The file PROTOCOL includes a description of the application protocol - in this example all communication is based on ASCII text strings.