Berkeley Sockets An example
|
|
- Gwendoline Banks
- 7 years ago
- Views:
Transcription
1 Berkeley Sockets An example Carsten Griwodz (adapted from lecture by Olav Lysne) Socket example 1
2 Transport layer: TCP Connection-oriented service TCP Transmission Control Protocol Connection-oriented service of the Internet RFC 793 TCP offers: Connections Handshake, end-system state, teardown Reliable, ordered, streamoriented data transfer Loss: acknowledgements and retransmissions Flow control: Send not faster than receiver can receive Congestion control: Send slower when the network is congested. Socket example 2
3 Transport layer: UDP Connectionless service UDP User Datagram Protocol Connectionless service of the Internet RFC 768 UDP offers: No connections Send immediately Unreliable, unordered, packetoriented data transfer Loss: messages are simply lost Messages arrive exactly as send No flow control Send as fast as programs want to No congestion control Ignore network problems Socket example 3
4 Reading and writing function calls int read( int sock, void* buffer, int n) sock must be connected int recv( int sock, void* buffer, int n, int options ) sock must be connected Sometimes useful option MSG_PEEK: read packet but leave it in the queue int recvfrom( int sock, void* buffer, int n, int options, struct sockaddr* src, int* srclen ) Meant for unconnected sockets If sock is connected, src is identical to sockaddr from accept Socket example 4
5 Reading and writing function calls int write( int sock, void* buffer, int n) sock must be connected int send( int sock, void* buffer, int n, int options ) sock must be connected int sendto( int sock, void* buffer, int n, int options, struct sockaddr* dest, int destlen ) Meant for unconnected sockets If sock is connected, dest address must refer to the other side Socket example 5
6 Read and Write in UDP Problem 1 UDP sender char buffer[20]; buffer[0] = a ; buffer[1] = b ; buffer[2] = c ; UDP receiver possibilities /* write abcdefghij */ sendto( sock, buffer, 10, 0, (struct sockaddr*)&dest, destlen ); /* write klmnopqrst */ sendto( sock, &buffer[10], 10, 0, (struct sockaddr*)&dest, destlen ); char buffer[21]; memset( buffer, 0, 21 ); struct sockaddr_in who; int wholen; wholen = sizeof(struct sockaddr_in); recvfrom( sock, &buffer[0], 5, 0, (struct sockaddr*)&who, &wholen ); /* buffer: abcde */ wholen = sizeof(struct sockaddr_in); recvfrom( sock, &buffer[5], 5, 0, (struct sockaddr*)&who, &wholen ); /* buffer: abcdeklmno */ wholen = sizeof(struct sockaddr_in); recvfrom( sock, &buffer[10], 5, 0, (struct sockaddr*)&who, &wholen ); /* waits forever -- no more data coming */ Socket example 6
7 Read and Write in UDP Problem 2 UDP sender char buffer[20]; buffer[0] = a ; buffer[1] = b ; buffer[2] = c ; UDP receiver possibilities /* write abcdefghij */ sendto( sock, buffer, 10, 0, (struct sockaddr*)&dest, destlen ); /* write klmnopqrst */ sendto( sock, &buffer[10], 10, 0, (struct sockaddr*)&dest, destlen ); char buffer[31]; memset( buffer, x, 30 ); struct sockaddr_in who; int wholen; buffer[30] = 0; wholen = sizeof(struct sockaddr_in); recvfrom( sock, &buffer[0], 15, 0, (struct sockaddr*)&who, &wholen ); /* buffer: abcdefghijxxxx */ wholen = sizeof(struct sockaddr_in); recvfrom( sock, &buffer[15], 15, 0, (struct sockaddr*)&who, &wholen ); /* buffer: abcdefghijxxxxxklmnopqrstxxxxx */ Socket example 7
8 Read and Write in UDP Problem 3 UDP sender char buffer[20]; buffer[0] = a ; buffer[1] = b ; buffer[2] = c ; UDP receiver possibilities /* write abcdefghij */ sendto( sock, buffer, 10, 0, (struct sockaddr*)&dest, destlen ); /* write klmnopqrst */ sendto( sock, &buffer[10], 10, 0, (struct sockaddr*)&dest, destlen ); char buffer[21]; memset( buffer, \0, 21 ); struct sockaddr_in who; int wholen; /* first datagram is lost */ wholen = sizeof(struct sockaddr_in); recvfrom( sock, &buffer[0], 10, 0, (struct sockaddr*)&who, &wholen ); /* buffer: klmnopqrst */ wholen = sizeof(struct sockaddr_in); recvfrom( sock, &buffer[10], 10, 0, (struct sockaddr*)&who, &wholen ); /* waits forever -- no more data coming */ Socket example 8
9 Read and Write in TCP TCP sender char buffer[2000]; int retval; buffer[0] = a ; buffer[1] = b ; buffer[2] = c ; /* write abcdefghij */ retval = write( sock, buffer, 2000 ); Typical retval == -1 Some kind of error, look at errno Retval == 0 The connection has been closed Retval n < 2000 You tried to send too fast Only n bytes have been sent Try sending the rest later Retval == 2000 All bytes have been sent Very untypical Retval < -1 Retval > 2000 Both cases: Have you used char retval instead of int retval? Socket example 9
10 Read and Write in TCP TCP receiver char buffer[2000]; int retval; /* write abcdefghij */ retval = read( sock, buffer, 2000 ); Typical retval == -1 Some kind of error, look at errno Retval == 0 The connection has been closed Retval n < 2000 Only n bytes have been received No new data has arrived recently Try reading the rest later Retval == 2000 All bytes have been received Very untypical Retval < -1 Retval > 2000 Both cases: Have you used char retval instead of int retval? Socket example 10
11 Chatting Most of you know that there are programs in the Internet that allow you to talk or chat with each other by means of your computers When two chat programs are connected, all that is shown on one screen will also be shown by the other program and vice versa One problem in connection with chatting is the program start: it is necessary that someone at the other ends is prepared to accept a call Socket example 11
12 Goal: Connection service We will write a network service that everyone can connect to, and which offers a connecting user a random chat partner For this, we need a chat server with the following capabilities: It must offer the server that all who want to chat with someone can connect to a known port number on a known computer When the server has two chat clients, these two chat clients are connected so that they can start chatting This connection is made by telling the two client how they can contact each other All communication with the chat server uses TCP Socket example 12
13 Goal: cntd. This require also that we write a client that is able to contact the server is table to tell the server where itself can be contacted can be told by the server about a chat partner, and how to contact the chat partner can be contacted by another chat client can chat with another chat client as soon as a connection is made Socket example 13
14 Application protocol towards the server Chat client 1 Chat server Chat client 2 connection L. Hostname 1 Hostname 1 Port number 1 connection L. Hostname 2 Hostname 2 Port number 2 You are the server You are the client L. Hostname 1 Hostname 1 Port number 1 disconnection disconnection Socket example 14
15 Application protocol chatting Chat client 1 Chat server Chat client 2 connection chat chat chat # disconnection Socket example 15
16 Some detail Port numbers are sent as 4 ASCII characters Machine names are sent as First 2 ASCII characters as a two digits decimal number indicating the number of bytes in the name Then the name, in the number of bytes indicated before A chatted line is sent as 80 ASCII characters When a user chats a line that starts with the character # the chat session ends Socket example 16
17 Helper function for communication It is worthwhile to put some socket functions into functions calls such that it becomes easier to use them A call that provides a socket that listens to a given port Hides bind, listen, struct sockaddr_in A call that provides a socket that is connection to a given hostname and port number Hides connect, name resolution, etc. Several read and write operations Socket example 17
18 Creation of a listen socket int TCPListenSocket(int port_number) struct sockaddr_in serveraddr, clientaddr; int clientaddrlen; int request_sock; int i; /* Allow that the socket to reuse a port that the server * has also used when it was started before. Otherwise * TCP waits for a few minutes before allowing reuse. */ i = 1; setsockopt( request_sock, SOL_SOCKET, SO_REUSEADDR, &i, sizeof(i)); /* Create the request socket. */ request_sock = socket(af_inet, SOCK_STREAM, IPPROTO_TCP); if (request_sock < 0) printf("creation of a socket failed.\n"); exit(1); /* Fill in the address structure */ bzero((void *) &serveraddr, sizeof(serveraddr)); serveraddr.sin_family = AF_INET; serveraddr.sin_addr.s_addr = INADDR_ANY; serveraddr.sin_port = htons(port_number); /* Bind the address to the socket. */ if (bind(request_sock, (struct sockaddr *)&serveraddr, sizeof serveraddr) < 0) printf("binding address to socket failed\n"); exit(1); /* Start listening to the socket */ if (listen(request_sock, SOMAXCONN) < 0) printf("can't listen to the socket\n"); exit(1); return request_sock; Socket example 18
19 Connection from the client side int TCPClientSocket(char machine[], int port_number) struct hostent *hostp; struct sockaddr_in serveraddr; int sock; /* Create a socket */ if ((sock = socket(af_inet, SOCK_STREAM, IPPROTO_TCP)) < 0) printf("creation of a socket failed.\n"); exit(1); /* Clean the serveraddr structure */ bzero((void *) &serveraddr, sizeof(serveraddr)); /* Initialize the serveraddr structure for the machine and port */ serveraddr.sin_family = AF_INET; /* Look in DNS for the IP address of the name */ if ((hostp = gethostbyname(machine)) == 0) fprintf(stderr,"ukjent machine %s\n",machine); exit(1); /* Put the address into the serveraddr structure */ memcpy(&serveraddr.sin_addr, hostp->h_addr, hostp->h_length); /* Add the port number */ serveraddr.sin_port = htons(port_number); /* Connect to the other machine */ if (connect(sock, (struct sockaddr *)&serveraddr, sizeof serveraddr) < 0) close(sock); printf("can't connect to %s\n",machine); exit(1); return sock; Socket example 19
20 Safe reading and writing /* Reads exactly l bytes from the socket */ int saferead(int so, char buf[], int l) int i; for (i=0; i<l; i++) buf[i]=safereadbyte(so); return l; /* Write to a socket in the same way as write, but returns an error message if the socket has been closed in the meantime */ int safewrite(int so, char buf[], int l) int i; if (i=write(so, buf, l)==0) printf("can't write to socket, connection is closed" ); exit(1); return i; /* Reads exactly one byte from a socket connection */ char safereadbyte(int so) int bytes; char buf[1]; bytes = read(so, buf, 1); /* Check whether the read worked */ if (bytes<0) perror("error in saferead"); if (close(so)) perror("close"); exit(1); /* Check whether the connection is still open */ if (bytes==0) printf("server: end of file on %d\n",so); if (close(so)) perror("close"); exit(1); return buf[0]; Socket example 20
21 Server: connecting two clients int connect_two_clients(int listen_socket) int client_socket1, client_socket2; struct sockaddr_in clientaddr1, clientaddr2; int clientaddrlen1, clientaddrlen2; char client_name1[80], client_name2[80]; char client_port1[5], client_port2[5]; char name_length1[3], name_length2[3]; memset( client_name1, 0, 80 ); memset( client_name2, 0, 80 ); memset( client_port1, 0, 5 ); memset( client_port2, 0, 5 ); memset( name_length1, 0, 3 ); memset( name_length2, 0, 3 ); /* Accept a connection from a first client */ clientaddrlen1 = sizeof(clientaddr1); client_socket1 = accept(listen_socket, (struct sockaddr *)&clientaddr1, &clientaddrlen1); if (client_socket1 < 0) perror("can't accept connection from a first chat client\n" ); /* Read machine name and port number that client sends * as its contact information */ saferead(client_socket1, name_length1, 2); saferead(client_socket1, client_name1, atoi(name_length1)); saferead(client_socket1, client_port1, 4); /* Accept a connection from second client */ clientaddrlen2 = sizeof(clientaddr2); client_socket2 = accept(listen_socket, (struct sockaddr *)&clientaddr2, &clientaddrlen2); if (client_socket2 < 0) perror("can't accept connection from a second chat client\n" ); /* Read machine name and port number that client sends * as its contact information */ saferead(client_socket2, name_length2, 2); saferead(client_socket2, client_name2, atoi(name_length2)); saferead(client_socket2, client_port2, 4); Socket example 21
22 Server: connecting two clients cntd. /* Tell the first client that it is the server in the chat * connection, and to wait for connection by a chat partner */ safewrite(client_socket1, "T", 1); /* Tell the second client that it is the client in the chat * connection, and to connect to the given name and port */ safewrite(client_socket2, "K", 1); safewrite(client_socket2, name_length1, 2); safewrite(client_socket2, client_name1, atoi(name_length1)); safewrite(client_socket2, client_port1, 4); /* Close the sockets for both clients */ close(client_socket1); close(client_socket2); return 0; Socket example 22
23 Server s main function int main(int argc, char *argv[]) int listen_socket; if( argc!= 2 ) fprintf(stderr,"usage: %s <port number>\n", argv[0]); exit(1); /* Start listening to the port number from the command * line */ listen_socket = TCPListenSocket(atoi(argv[1])); /* Connect pairs of clients forever */ while (1) connect_two_clients(listen_socket); /* We don't ever come here */ close(listen_socket); Socket example 23
24 Client: contacting the server int getchatpartner( char servername[], char serverport[], char myname[], char myport[] ) int sock, listen_socket, partneraddresslength; struct sockaddr partneraddress; char name_length[3]; char client_or_server[2]; char chatpartnername[80]; char chatpartnerport[5]; char buf[80]; memset( name_length, 0, 3 ); memset( client_or_server, 0, 2 ); memset( chatpartnername, 0, 80 ); memset( chatpartnerport, 0, 5 ); /* Connect to a chat server */ sock = TCPClientSocket(servername,atoi(serverport)); /* Tell the server how you can be contacted by a chat * partner */ sprintf(name_length, "%d", strlen(myname)); safewrite(sock, name_length, 2); safewrite(sock, myname, strlen(myname)); safewrite(sock, myport, 4); /* Receive from the server whether you will act as a client * or as a server in the chat */ saferead(sock, client_or_server, 1); /* Create a socket that is read to accept connections from * a chat partner */ listen_socket = TCPListenSocket(atoi(myport)); Socket example 24
25 Client: contacting the server cntd. if (client_or_server[0] == 'K') /* You will be the client in the chat */ /* Close the socket that you would have * needed as a chat server */ close(listen_socket); /* Read the length of the chat partner's hostname */ saferead(sock, name_length, 2); /* Read the chat partner's hostname */ saferead(sock, chatpartnername, atoi(name_length)); /* Read the chat partner's port number */ saferead(sock, chatpartnerport, 4); /* Close the connection to the server */ close(sock); /* Connect to the chat partner */ sock = TCPClientSocket(chatpartnername, atoi(chatpartnerport)); /* Write to the screen that the user can talk first */ printf("connection create, you talk first!!\n"); else /* Act as the server in the chat, no more information * is coming from the server */ close(sock); /* Accept a connection from a chat partner */ partneraddresslength = sizeof(partneraddress); sock = accept(listen_socket, (struct sockaddr *)&partneraddress, &partneraddresslength); if (sock < 0) perror("error accepting connection from chat partner" ); /* Write to the screen that the chat partner talks first */ printf("connection create, partner talks first!!\n"); saferead(sock, buf,80); printf(buf); return sock; Socket example 25
26 Client: chatting and main /* A function that alternately reads a text string from * standard input and sends it over the TCP connection, and * receive a text string and prints it on the screen. */ int chat(int socket) char text[80]; while (1) fgets(text,80,stdin); write(socket,text, 80); if (text[0]=='#') return 0; saferead(socket, text,80); if (text[0]=='#') return 0; printf(text); int main(int argc, char *argv[]) int sock; if( argc!= 5 ) fprintf( stderr, "Usage: %s <servername> <serverport> <myname> <myport>\n", argv[0]); exit(1); /* ask for a chart partner */ sock = getchatpartner(argv[1], argv[2], argv[3], argv[4]); /* chat along!*/ chat(sock); /* Close the chat socket */ close(sock); Socket example 26
27 Weaksnesses of the implementation Server accounts hardly for wrong client behaviour Sending characters when a post number is required Client connects but does not send data, chat server ends Server forwards simple what it receives, without checking that the machine name is the calling client s Chat client can only send in turns That is different in a real chat session, or in real life Everything that is typed should be sent, without an understanding of turns Much more! Socket example 27
28 getchatpartner begins as before int getchatpartner( char servername[], char serverport[], char myname[], char myport[] ) int sock, listen_socket, partneraddresslength; struct sockaddr partneraddress; char name_length[3]; char client_or_server[2]; char chatpartnername[80]; char chatpartnerport[5]; char buf[80]; memset( name_length, 0, 3 ); memset( client_or_server, 0, 2 ); memset( chatpartnername, 0, 80 ); memset( chatpartnerport, 0, 5 ); /* Connect to a chat server */ sock = TCPClientSocket(servername,atoi(serverport)); /* Tell the server how you can be contacted by a chat * partner */ sprintf(name_length, "%d", strlen(myname)); safewrite(sock, name_length, 2); safewrite(sock, myname, strlen(myname)); safewrite(sock, myport, 4); /* Receive from the server whether you will act as a client * or as a server in the chat */ saferead(sock, client_or_server, 1); /* Create a socket that is read to accept connections from * a chat partner */ listen_socket = TCPListenSocket(atoi(myport)); Socket example 28
29 ...buts ends differently if (client_or_server[0] == 'K') /* You will be the client in the chat */ /* Close the socket that you would have needed * as a chat server */ close(listen_socket); /* Read the length of the chat partner's hostname */ saferead(sock, name_length, 2); /* Read the chat partner's hostname */ saferead(sock, chatpartnername, atoi(name_length)); /* Read the chat partner's port number */ saferead(sock, chatpartnerport, 4); /* Close the connection to the server */ close(sock); else /* Act as the server in the chat, no more information * is coming from the server */ close(sock); /* Accept a connection from a chat partner */ partneraddresslength = sizeof(partneraddress); sock = accept(listen_socket, (struct sockaddr *)&partneraddress, &partneraddresslength); if (sock < 0) perror("error accepting connection from chat partner" ); printf("connection create, chat along!!\n"); return sock; /* Connect to the chat partner */ sock = TCPClientSocket(chatpartnername, atoi(chatpartnerport)); Socket example 29
30 chat function used separate processes for reading and writing, so that the don t block each other: int chat(int socket) int status; char text[10]; if (safefork()==0) while (text[0]!= '#') fgets(text,80,stdin); write(socket,text, 80); else while (text[0]!= '#') saferead(socket, text,80); printf(text); int main(int argc, char *argv[]) int sock; /* get a chat partner */ sock = getchatpartner(argv[1], argv[2], argv[3], argv[4]); /* start chatting */ chat(sock); /* close the chat socket */ close(sock); Socket example 30
31 Data types Basic data types Have a certain number of bits Not very important in platform-dependent nonnetworked applications Not very important in platform-dependent networked applications Very important in platform-independent networked applications Socket example 31
32 Data types Basic data types C data types char unsigned char - 8 bits short unsigned short - 16 bits int unsigned int - 32 (or 64) bits long unsigned long - 32 or 64 bits long long unsigned long long - 64 (or 128) bits Socket API portable types size_t 32 bits unsigned, 0 2^32-1 ssize_t 32 bits signed, -2^31 2^31-1 Socket example 32
33 IP addresses and hostnames IPv4 host address When written on paper, it looks like dotted decimal notation Represents a 32 bit address Binary in bits Hexadecimal in bytes 0x81 0xf0 0x47 0xd5 One 4 byte int on x86, StrongARM, XScale, 0xd547f081 One 4 byte int on PowerPC, POWER, Sparc, 0x81f047d5 In network byte order 0x81f047d5 Socket example 33
34 IP addresses and hostnames On x86 etc. ntohl(0x81f047d5) == 0xd547f081 On PowerPC etc. ntohl(0x81f047d5) == 0x81f047d5 Socket example 34
35 IP addresses and hostnames IPv4 host address Corresponds to one network interface card (NIC) IPv4 network address Looks like /24 Refers to add addresses that that the same first 24 bits is in that network Socket example 35
36 IP addresses and hostnames IPv4 networks Institutes and companies own network address ranges e.g /16 - UiO e.g /8 IBM Institutes and companies assign addresses to their computers Fixed addresses Temporary addresses Class A addresses 0 network host / /8 Class B addresses Class C addresses Class D or multicast addresses 10 network host 110 network host 1110 multicast address / / / / Socket example 36
37 IP addresses and hostnames IPv4 networks Institutes and companies own network address ranges e.g /16 - UiO e.g /8 IBM Institutes and companies assign addresses to their computers Fixed addresses Temporary addresses They can also create subnets IFI has subnetsof UiO saddressspace E.g / can t be used for a computer, it s the network s address can t be used for a computer, it s an address for all computers in the network, the broadcast address Socket example 37
38 IP addresses and hostnames These are many addresses Why do we need IPv6? Most IPv4 addresses have owners No matter whether the addresses are needed Most in the US, using 1% Several in Europe Really tight in Asia, only assigned when need is proven IPv6 addresses 128 bits In text 2FFF:80:0:0:0:0:94:1 8 times 16 bits Hard to remember own address bit top level 32 bit next level 16 bit site level 64 bit interface id Socket example 38
39 IP addresses and hostnames Hostnames More exactly fully qualified host names Look like niu.ifi.uio.no Host niu In subdomain ifi, Institutt for Informatik In domain uio, Universitet i Oslo In top level domain no, Norway Who decided this?.no.uio.ifi niu - IANA gave it to Uninett - Uninett gave it to UiO - USIT, UiO s drift, gave it to IFI - IFI drift gave it to the machine Socket example 39
40 Name resolution Gethostbyname Takes a hostname Returns information aboutthathostname Including its IP address How? struct hostent *hostp; struct sockaddr_in serveraddr; int sock; /* Look in DNS for the IP address of the name */ if ((hostp = gethostbyname(machine)) == 0) fprintf(stderr, Unknown machine %s\n",machine); exit(1); bzero((void *) &serveraddr, sizeof(serveraddr)); serveraddr.sin_family = AF_INET; memcpy(&serveraddr.sin_addr, hostp->h_addr, hostp->h_length); serveraddr.sin_port = htons(port_number); Socket example 40
41 Name resolution Gethostbyname Takes a hostname Returns information aboutthathostname Including its IP address How? First: Look into /etc/hosts But only for few, special, well-known hosts # # list of statically known hosts # localhost argul.ifi.uio.no argul fileserver.ifi.uio.no fileserver Socket example 41
42 Name resolution Gethostbyname Root name server Takes a hostname Returns information aboutthathostname Including its IP address How? Then: ifi.uio.no dns.umass.edu Using DNS the Domain Name System 1 6 a121.ifi.uio.no gaia.cs.umass.edu Socket example 42
43 Name resolution Gethostbyname Takes a hostname Returns information aboutthathostname Including its IP address Return value Pointer to struct hostent Contains more than just an IP address Other names All addresses #define h_addr h_addr_list[0] struct hostent /* official hostname */ char* h_name; /* alias names of the host * entry NULL indicates end of the list */ char **h_aliases; /* host address type, e.g. AF_INET */ int h_addrtype; /* length of each address */ int h_length; /* list of addresses, primary is 0 th entry * entry 0 indicates end of the list */ char** h_addr_list; ; Socket example 43
44 Name resolution Finding the own hostname Command line ifconfig a (Unix) ipconfig /a (Windows) Gives you all IP addresses Typically 2: localhost and the actual one Inside a program Difficult without a connected socket With a connected socket: struct hostent* getsockname(int sock); Similar to gethostbyname eth0 Link encap:ethernet HWaddr 00:C0:4F:A3:0C:D3 inet addr: Bcast: Mask: UP BROADCAST NOTRAILERS RUNNING MULTICAST MTU:1500 Metric:1 RX packets: errors:65 dropped:0 overruns:203 frame:65 TX packets: errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:100 RX bytes: ( Mb) TX bytes: ( Mb) Interrupt:19 Base address:0xfcc0 lo Link encap:local Loopback inet addr: Mask: UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:26429 errors:0 dropped:0 overruns:0 frame:0 TX packets:26429 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes: (5.6 Mb) TX bytes: (5.6 Mb) Socket example 44
45 Netmasks Help your computer find the way All computers with addresses in the same network can be reached directly If you know your own computer s address, e.g and the relevant bits of your network, e.g. /24 you know that all computers with addresses ? are in the same network For each computer with another address, a member of the own network (computer or router) must be found that can send the data into the right direction This is sometimes wrong Understanding of network addresses becomes important Tell your computer its network address For computers with a fixed IP address: set up once For computers with a dynamic address: set up together with address Socket example 45
46 Netmasks The computer Is not told directly that it s on the network /24 Instead it is told that it s address is And that its netmask is these are 24 bits It figures the network address out from this In ifconfig or ipconfig Lists hostname E.g Lists netmask e.g Or 0xffffff00 Or the highest 24 bits set Implies that is part of the subnet /24 which is the same as /24 This answer from ifconfig implies also that All computers in the net /24 are reachable directly Without router Socket example 46
47 Select int select( int max_fd, fd_set* read_set, fd_set* write_set, fd_set* except_set, struct timeval* timeout ); Complicated at first But very useful Can wait for activity on many sockets New connections on request sockets New data on connected sockets Closing of a connected socket Ready-to-send on a socket Can wait for user input Can wait for timeouts Socket example 47
48 Select int select( int max_fd, fd_set* read_set, fd_set* write_set, fd_set* except_set, struct timeval* timeout ); For servers Serve many clients at once Handle clients that close connections, clients that crash, For the chat example Wait for data from chat partner Wait for typing of the user Socket example 48
49 Select int select( int max_fd, fd_set* read_set, fd_set* write_set, fd_set* except_set, struct timeval* timeout ); read_set Arriving connect requests Arriving data Closing sockets write_set Non often used Non-blocking send is finished except_set Hardly ever used sendto(.,.,.,msg_oob) Socket example 49
50 Select void wait_for_all(int clientsock[], int clients) fd_set read_set; int i,act,top=0; FD_ZERO(&read_set); for( i=0; i<clients; i++ ) FD_SET(clientsock[i],&read_set); top = MAX(top,clientsock[i]); act = select( top+1, &read_set, NULL, NULL, NULL); Using only the read_set is typical Clear the read_set Must be done every time Put all sockets into the read set Find the highest socket number, add 1 NULL timeout Means forever Call select waits for arriving data Socket example 50
51 Select void wait_some_time(int sec, int usec) struct timeval timeout; timeout.tv_sec = sec; timeout.tv_usec = usec; act = select( 0, NULL, NULL, NULL, &timeout ); select can also wait only for a timeout Without sockets Timeout parameter NULL means wait forever Timeval 5,0 means wait 5 seconds Timeval 0,0 means don t wait at all Socket example 51
52 Summary Names and addresses IP addresses Fully qualified hostnames Domain Name System How to use it Connections in TCP and UDP Functions The select function call Several functions for reading and writing Socket example 52
Network Programming with Sockets. Anatomy of an Internet Connection
Network Programming with Sockets Anatomy of an Internet Connection Client socket address 128.2.194.242:51213 socket address 208.216.181.15:80 Client Connection socket pair (128.2.194.242:51213, 208.216.181.15:80)
More informationSocket Programming. Kameswari Chebrolu Dept. of Electrical Engineering, IIT Kanpur
Socket Programming Kameswari Chebrolu Dept. of Electrical Engineering, IIT Kanpur Background Demultiplexing Convert host-to-host packet delivery service into a process-to-process communication channel
More informationSocket Programming in C/C++
September 24, 2004 Contact Info Mani Radhakrishnan Office 4224 SEL email mradhakr @ cs. uic. edu Office Hours Tuesday 1-4 PM Introduction Sockets are a protocol independent method of creating a connection
More informationIntroduction to Socket programming using C
Introduction to Socket programming using C Goal: learn how to build client/server application that communicate using sockets Vinay Narasimhamurthy S0677790@sms.ed.ac.uk CLIENT SERVER MODEL Sockets are
More informationOverview. Socket Programming. Using Ports to Identify Services. UNIX Socket API. Knowing What Port Number To Use. Socket: End Point of Communication
Overview Socket Programming EE 122: Intro to Communication Networks Vern Paxson TAs: Lisa Fowler, Daniel Killebrew, Jorge Ortiz Socket Programming: how applications use the network Sockets are a C-language
More informationIP Network Layer. Datagram ID FLAG Fragment Offset. IP Datagrams. IP Addresses. IP Addresses. CSCE 515: Computer Network Programming TCP/IP
CSCE 515: Computer Network Programming TCP/IP IP Network Layer Wenyuan Xu Department of Computer Science and Engineering University of South Carolina IP Datagrams IP is the network layer packet delivery
More informationIntroduction to Socket Programming Part I : TCP Clients, Servers; Host information
Introduction to Socket Programming Part I : TCP Clients, Servers; Host information Keywords: sockets, client-server, network programming-socket functions, OSI layering, byte-ordering Outline: 1.) Introduction
More informationPorting applications & DNS issues. socket interface extensions for IPv6. Eva M. Castro. ecastro@dit.upm.es. dit. Porting applications & DNS issues UPM
socket interface extensions for IPv6 Eva M. Castro ecastro@.upm.es Contents * Introduction * Porting IPv4 applications to IPv6, using socket interface extensions to IPv6. Data structures Conversion functions
More informationELEN 602: Computer Communications and Networking. Socket Programming Basics
1 ELEN 602: Computer Communications and Networking Socket Programming Basics A. Introduction In the classic client-server model, the client sends out requests to the server, and the server does some processing
More informationTCP/IP - Socket Programming
TCP/IP - Socket Programming jrb@socket.to.me Jim Binkley 1 sockets - overview sockets simple client - server model look at tcpclient/tcpserver.c look at udpclient/udpserver.c tcp/udp contrasts normal master/slave
More informationBSD Sockets Interface Programmer s Guide
BSD Sockets Interface Programmer s Guide Edition 6 B2355-90136 HP 9000 Networking E0497 Printed in: United States Copyright 1997 Hewlett-Packard Company. Legal Notices The information in this document
More informationElementary Name and Address. Conversions
Elementary Name and Address Domain name system Conversions gethostbyname Function RES_USE_INET6 resolver option gethostbyname2 Function and IPv6 support gethostbyaddr Function uname and gethostname Functions
More informationConcurrent Server Design Alternatives
CSCE 515: Computer Network Programming ------ Advanced Socket Programming Wenyuan Xu Concurrent Server Design Alternatives Department of Computer Science and Engineering University of South Carolina Ref:
More informationNS3 Lab 1 TCP/IP Network Programming in C
NS3 Lab 1 TCP/IP Network Programming in C Dr Colin Perkins School of Computing Science University of Glasgow http://csperkins.org/teaching/ns3/ 13/14 January 2015 Introduction The laboratory exercises
More informationSession NM059. TCP/IP Programming on VMS. Geoff Bryant Process Software
Session NM059 TCP/IP Programming on VMS Geoff Bryant Process Software Course Roadmap Slide 160 NM055 (11:00-12:00) Important Terms and Concepts TCP/IP and Client/Server Model Sockets and TLI Client/Server
More informationUNIX Sockets. COS 461 Precept 1
UNIX Sockets COS 461 Precept 1 Clients and Servers Client program Running on end host Requests service E.g., Web browser Server program Running on end host Provides service E.g., Web server GET /index.html
More informationICT SEcurity BASICS. Course: Software Defined Radio. Angelo Liguori. SP4TE lab. angelo.liguori@uniroma3.it
Course: Software Defined Radio ICT SEcurity BASICS Angelo Liguori angelo.liguori@uniroma3.it SP4TE lab 1 Simple Timing Covert Channel Unintended information about data gets leaked through observing the
More informationBASIC TCP/IP NETWORKING
ch01 11/19/99 4:20 PM Page 1 CHAPTER 1 BASIC TCP/IP NETWORKING When you communicate to someone or something else, you need to be able to speak a language that the listener understands. Networking requires
More informationSocket Programming. Srinidhi Varadarajan
Socket Programming Srinidhi Varadarajan Client-server paradigm Client: initiates contact with server ( speaks first ) typically requests service from server, for Web, client is implemented in browser;
More informationINTRODUCTION UNIX NETWORK PROGRAMMING Vol 1, Third Edition by Richard Stevens
INTRODUCTION UNIX NETWORK PROGRAMMING Vol 1, Third Edition by Richard Stevens Read: Chapters 1,2, 3, 4 Communications Client Example: Ex: TCP/IP Server Telnet client on local machine to Telnet server on
More informationElementary Name and Address Conversions
Elementary Name and Address Conversions Domain name system gethostbyname Function RES_USE_INET6 resolver option gethostbyname2 Function and IPv6 support gethostbyaddr Function uname and gethostname Functions
More informationNetwork Programming with Sockets. Process Management in UNIX
Network Programming with Sockets This section is a brief introduction to the basics of networking programming using the BSD Socket interface on the Unix Operating System. Processes in Unix Sockets Stream
More informationTutorial on Socket Programming
Tutorial on Socket Programming Computer Networks - CSC 458 Department of Computer Science Seyed Hossein Mortazavi (Slides are mainly from Monia Ghobadi, and Amin Tootoonchian, ) 1 Outline Client- server
More informationA Client Server Transaction. Introduction to Computer Systems 15 213/18 243, fall 2009 18 th Lecture, Nov. 3 rd
A Client Server Transaction Introduction to Computer Systems 15 213/18 243, fall 2009 18 th Lecture, Nov. 3 rd 4. Client handles response Client process 1. Client sends request 3. Server sends response
More informationImplementing Network Software
Implementing Network Software Outline Sockets Example Process Models Message Buffers Spring 2007 CSE 30264 1 Sockets Application Programming Interface (API) Socket interface socket : point where an application
More informationLab 4: Socket Programming: netcat part
Lab 4: Socket Programming: netcat part Overview The goal of this lab is to familiarize yourself with application level programming with sockets, specifically stream or TCP sockets, by implementing a client/server
More informationUnix System Administration
Unix System Administration Chris Schenk Lecture 08 Tuesday Feb 13 CSCI 4113, Spring 2007 ARP Review Host A 128.138.202.50 00:0B:DB:A6:76:18 Host B 128.138.202.53 00:11:43:70:45:81 Switch Host C 128.138.202.71
More informationUnix Network Programming
Introduction to Computer Networks Polly Huang EE NTU http://cc.ee.ntu.edu.tw/~phuang phuang@cc.ee.ntu.edu.tw Unix Network Programming The socket struct and data handling System calls Based on Beej's Guide
More informationDNS Domain Name System
Domain Name System DNS Domain Name System The domain name system is usually used to translate a host name into an IP address Domain names comprise a hierarchy so that names are unique, yet easy to remember.
More informationTFTP Usage and Design. Diskless Workstation Booting 1. TFTP Usage and Design (cont.) CSCE 515: Computer Network Programming ------ TFTP + Errors
CSCE 515: Computer Network Programming ------ TFTP + Errors Wenyuan Xu Department of Computer Science and Engineering University of South Carolina TFTP Usage and Design RFC 783, 1350 Transfer files between
More informationComputer Networks. Introduc)on to Naming, Addressing, and Rou)ng. Week 09. College of Information Science and Engineering Ritsumeikan University
Computer Networks Introduc)on to Naming, Addressing, and Rou)ng Week 09 College of Information Science and Engineering Ritsumeikan University MAC Addresses l MAC address is intended to be a unique identifier
More information3. The Domain Name Service
3. The Domain Name Service n Overview and high level design n Typical operation and the role of caching n Contents of DNS Resource Records n Basic message formats n Configuring/updating Resource Records
More informationDomain Name System (1)! gethostbyname (2)! gethostbyaddr (2)!
Lecture 5 Overview Last Lecture Socket Options and elementary UDP sockets This Lecture Name and address conversions & IPv6 Source: Chapter 11 Next Lecture Multicast Source: Chapter 12 1 Domain Name System
More informationUNIX. Sockets. mgr inż. Marcin Borkowski
UNIX Sockets Introduction to Sockets Interprocess Communication channel: descriptor based two way communication can connect processes on different machines Three most typical socket types (colloquial names):
More informationLecture Computer Networks
Prof. Dr. H. P. Großmann mit M. Rabel sowie H. Hutschenreiter und T. Nau Sommersemester 2012 Institut für Organisation und Management von Informationssystemen Thomas Nau, kiz Lecture Computer Networks
More informationInternet Control Protocols Reading: Chapter 3
Internet Control Protocols Reading: Chapter 3 ARP - RFC 826, STD 37 DHCP - RFC 2131 ICMP - RFC 0792, STD 05 1 Goals of Today s Lecture Bootstrapping an end host Learning its own configuration parameters
More informationLecture 9: Network Security Introduction
ENTS 689i Lecture 9: Network Security Introduction Part III: Network Security Part III: Goals Review how networks work Explore why networks break Understand tools and techniques used by attackers (threats)
More informationA Client-Server Transaction. Systemprogrammering 2006 Föreläsning 8 Network Programming. Hardware Org of a Network Host.
Systemprogrammering 2006 Föreläsning 8 Network Programming Topics -server programming model A -Server Transaction Every network application is based on the client-server model: A server process and one
More informationSocket Programming. Request. Reply. Figure 1. Client-Server paradigm
Socket Programming 1. Introduction In the classic client-server model, the client sends out requests to the server, and the server does some processing with the request(s) received, and returns a reply
More informationClient / Server Programming with TCP/IP Sockets
Client / Server Programming with TCP/IP Sockets Author: Rajinder Yadav Date: Sept 9, 2007 Revision: Mar 11, 2008 Web: http://devmentor.org Email: rajinder@devmentor.org Table of Content Networks... 2 Diagram
More informationHostnames. HOSTS.TXT was a bottleneck. Once there was HOSTS.TXT. CSCE515 Computer Network Programming. Hierarchical Organization of DNS
Hostnames CSCE 515: Computer Network Programming ------ Address Conversion Function and DNS RFC 1034, RFC 1035 Wenyuan Xu http://www.cse..edu/~wyxu/ce515f07.html Department of Computer Science and Engineering
More informationNetworking Test 4 Study Guide
Networking Test 4 Study Guide True/False Indicate whether the statement is true or false. 1. IPX/SPX is considered the protocol suite of the Internet, and it is the most widely used protocol suite in LANs.
More informationLecture 8. IP Fundamentals
Lecture 8. Internet Network Layer: IP Fundamentals Outline Layer 3 functionalities Internet Protocol (IP) characteristics IP packet (first look) IP addresses Routing tables: how to use ARP Layer 3 functionalities
More informationSetting Up A High-Availability Load Balancer (With Failover and Session Support) With Perlbal/Heartbeat On Debian Etch
By Falko Timme Published: 2009-01-11 19:32 Setting Up A High-Availability Load Balancer (With Failover and Session Support) With Perlbal/Heartbeat On Debian Etch Version 1.0 Author: Falko Timme
More informationProgrammation Systèmes Cours 9 UNIX Domain Sockets
Programmation Systèmes Cours 9 UNIX Domain Sockets Stefano Zacchiroli zack@pps.univ-paris-diderot.fr Laboratoire PPS, Université Paris Diderot 2013 2014 URL http://upsilon.cc/zack/teaching/1314/progsyst/
More informationLinux TCP/IP Network Management
Linux TCP/IP Network Management Arnon Rungsawang fenganr@ku.ac.th Massive Information & Knowledge Engineering Department of Computer Engineering Faculty of Engineering Kasetsart University, Bangkok, Thailand.
More informationThe exam has 110 possible points, 10 of which are extra credit. There is a Word Bank on Page 8. Pages 7-8 can be removed from the exam.
CS326e Spring 2014 Midterm Exam Name SOLUTIONS UTEID The exam has 110 possible points, 10 of which are extra credit. There is a Word Bank on Page 8. Pages 7-8 can be removed from the exam. 1. [4 Points]
More informationWriting a C-based Client/Server
Working the Socket Writing a C-based Client/Server Consider for a moment having the massive power of different computers all simultaneously trying to compute a problem for you -- and still being legal!
More informationIntroduction to NetGUI
Computer Network Architectures gsyc-profes@gsyc.escet.urjc.es December 5, 2007 (cc) 2007. Algunos derechos reservados. Este trabajo se entrega bajo la licencia Creative Commons Attribution-ShareAlike.
More informationInternet Protocol version 4 Part I
Internet Protocol version 4 Part I Claudio Cicconetti International Master on Information Technology International Master on Communication Networks Engineering Table of Contents
More informationPacket Sniffing and Spoofing Lab
SEED Labs Packet Sniffing and Spoofing Lab 1 Packet Sniffing and Spoofing Lab Copyright c 2014 Wenliang Du, Syracuse University. The development of this document is/was funded by the following grants from
More informationCSE 333 SECTION 6. Networking and sockets
CSE 333 SECTION 6 Networking and sockets Goals for Today Overview of IP addresses Look at the IP address structures in C/C++ Overview of DNS Write your own (short!) program to do the domain name IP address
More informationEthernet. Ethernet. Network Devices
Ethernet Babak Kia Adjunct Professor Boston University College of Engineering ENG SC757 - Advanced Microprocessor Design Ethernet Ethernet is a term used to refer to a diverse set of frame based networking
More informationTCP/IP Basis. OSI Model
TCP/IP Basis 高 雄 大 學 資 訊 工 程 學 系 嚴 力 行 Source OSI Model Destination Application Presentation Session Transport Network Data-Link Physical ENCAPSULATION DATA SEGMENT PACKET FRAME BITS 0101010101010101010
More informationIP Addressing. -Internetworking (with TCP/IP) -Classful addressing -Subnetting and Supernetting -Classless addressing
IP Addressing -Internetworking (with TCP/IP) -Classful addressing -Subnetting and Supernetting -Classless addressing Internetworking The concept of internetworking: we need to make different networks communicate
More informationApplication Architecture
A Course on Internetworking & Network-based Applications CS 6/75995 Internet-based Applications & Systems Design Kent State University Dept. of Science LECT-2 LECT-02, S-1 2 Application Architecture Today
More informationIBM i Version 7.2. Programming Socket programming IBM
IBM i Version 7.2 Programming Socket programming IBM IBM i Version 7.2 Programming Socket programming IBM Note Before using this information and the product it supports, read the information in Notices
More informationTCP/IP Fundamentals. OSI Seven Layer Model & Seminar Outline
OSI Seven Layer Model & Seminar Outline TCP/IP Fundamentals This seminar will present TCP/IP communications starting from Layer 2 up to Layer 4 (TCP/IP applications cover Layers 5-7) IP Addresses Data
More informationTCP/IP Network Essentials. Linux System Administration and IP Services
TCP/IP Network Essentials Linux System Administration and IP Services Layers Complex problems can be solved using the common divide and conquer principle. In this case the internals of the Internet are
More informationCommunication Networks. Introduction & Socket Programming Yuval Rochman
Communication Networks Introduction & Socket Programming Yuval Rochman Administration Staff Lecturer: Prof. Hanoch Levy hanoch AT cs tau Office hours: by appointment Teaching Assistant: Yuval Rochman yuvalroc
More informationWorkshop on Scientific Applications for the Internet of Things (IoT) March 16-27 2015
Workshop on Scientific Applications for the Internet of Things (IoT) March 16-27 2015 IPv6 in practice with RPi Alvaro Vives - alvaro@nsrc.org Contents 1 Lab topology 2 IPv6 Configuration 2.1 Linux commands
More informationNetwork Programming. Chapter 11. 11.1 The Client-Server Programming Model
Chapter 11 Network Programming Network applications are everywhere. Any time you browse the Web, send an email message, or pop up an X window, you are using a network application. Interestingly, all network
More informationTransport layer protocols. Message destination: Socket +Port. Asynchronous vs. Synchronous. Operations of Request-Reply. Sockets
Transport layer protocols Interprocess communication Synchronous and asynchronous comm. Message destination Reliability Ordering Client Server Lecture 15: Operating Systems and Networks Behzad Bordbar
More informationThe POSIX Socket API
The POSIX Giovanni Agosta Piattaforme Software per la Rete Modulo 2 G. Agosta The POSIX Outline Sockets & TCP Connections 1 Sockets & TCP Connections 2 3 4 G. Agosta The POSIX TCP Connections Preliminaries
More informationCS244A Review Session Routing and DNS
CS244A Review Session Routing and DNS January 18, 2008 Peter Pawlowski Slides derived from: Justin Pettit (2007) Matt Falkenhagen (2006) Yashar Ganjali (2005) Guido Appenzeller (2002) Announcements PA
More informationComputer Networks Network architecture
Computer Networks Network architecture Saad Mneimneh Computer Science Hunter College of CUNY New York - Networks are like onions - They stink? - Yes, no, they have layers Shrek and Donkey 1 Introduction
More informationSMTP-32 Library. Simple Mail Transfer Protocol Dynamic Link Library for Microsoft Windows. Version 5.2
SMTP-32 Library Simple Mail Transfer Protocol Dynamic Link Library for Microsoft Windows Version 5.2 Copyright 1994-2003 by Distinct Corporation All rights reserved Table of Contents 1 Overview... 5 1.1
More informationLecture 15. IP address space managed by Internet Assigned Numbers Authority (IANA)
Lecture 15 IP Address Each host and router on the Internet has an IP address, which consist of a combination of network number and host number. The combination is unique; no two machines have the same
More informationObjectives of Lecture. Network Architecture. Protocols. Contents
Objectives of Lecture Network Architecture Show how network architecture can be understood using a layered approach. Introduce the OSI seven layer reference model. Introduce the concepts of internetworking
More informationtransmission media and network topologies client/server architecture layers, protocols, and sockets
Network Programming 1 Computer Networks transmission media and network topologies client/server architecture layers, protocols, and sockets 2 Network Programming a simple client/server interaction the
More informationTechnical Support Information Belkin internal use only
The fundamentals of TCP/IP networking TCP/IP (Transmission Control Protocol / Internet Protocols) is a set of networking protocols that is used for communication on the Internet and on many other networks.
More informationICS 351: Today's plan
ICS 351: Today's plan Quiz, on overall Internet function, linux and IOS commands, network monitoring, protocols IPv4 addresses: network part and host part address masks IP interface configuration IPv6
More informationInternet Addresses (You should read Chapter 4 in Forouzan)
Internet Addresses (You should read Chapter 4 in Forouzan) IP Address is 32 Bits Long Conceptually the address is the pair (NETID, HOSTID) Addresses are assigned by the internet company for assignment
More informationNetwork layer" 1DT066! Distributed Information Systems!! Chapter 4" Network Layer!! goals: "
1DT066! Distributed Information Systems!! Chapter 4" Network Layer!! Network layer" goals: "! understand principles behind layer services:" " layer service models" " forwarding versus routing" " how a
More informationLecture 17. Process Management. Process Management. Process Management. Inter-Process Communication. Inter-Process Communication
Process Management Lecture 17 Review February 25, 2005 Program? Process? Thread? Disadvantages, advantages of threads? How do you identify processes? How do you fork a child process, the child process
More informationCarnegie Mellon. Internetworking. 15-213: Introduc0on to Computer Systems 19 th Lecture, Oct. 28, 2010. Instructors: Randy Bryant and Dave O Hallaron
Internetworking 15-213: Introduc0on to Computer Systems 19 th Lecture, Oct. 28, 2010 Instructors: Randy Bryant and Dave O Hallaron 1 A Client- Server Transac8on 4. Client handles response Client process
More information3.5. cmsg Developer s Guide. Data Acquisition Group JEFFERSON LAB. Version
Version 3.5 JEFFERSON LAB Data Acquisition Group cmsg Developer s Guide J E F F E R S O N L A B D A T A A C Q U I S I T I O N G R O U P cmsg Developer s Guide Elliott Wolin wolin@jlab.org Carl Timmer timmer@jlab.org
More informationTransport Layer Protocols
Transport Layer Protocols Version. Transport layer performs two main tasks for the application layer by using the network layer. It provides end to end communication between two applications, and implements
More informationTwin Peaks Software High Availability and Disaster Recovery Solution For Linux Email Server
Twin Peaks Software High Availability and Disaster Recovery Solution For Linux Email Server Introduction Twin Peaks Softwares Replication Plus software is a real-time file replication tool, based on its
More informationProgramming with TCP/IP Best Practices
Programming with TCP/IP Best Practices Matt Muggeridge TCP/IP for OpenVMS Engineering "Be liberal in what you accept, and conservative in what you send" Source: RFC 1122, section 1.2.2 [Braden, 1989a]
More informationProgramming With Sockets 2
Programming With Sockets 2 This chapter presents the socket interface and illustrates them with sample programs. The programs demonstrate the Internet domain sockets. What Are Sockets page 12 Socket Tutorial
More informationInternet Working 5 th lecture. Chair of Communication Systems Department of Applied Sciences University of Freiburg 2004
5 th lecture Chair of Communication Systems Department of Applied Sciences University of Freiburg 2004 1 43 Last lecture Lecture room hopefully all got the message lecture on tuesday and thursday same
More informationHands On Activities: TCP/IP Network Monitoring and Management
Hands On Activities: TCP/IP Network Monitoring and Management 1. TCP/IP Network Management Tasks TCP/IP network management tasks include Examine your physical and IP network address Traffic monitoring
More informationsys socketcall: Network systems calls on Linux
sys socketcall: Network systems calls on Linux Daniel Noé April 9, 2008 The method used by Linux for system calls is explored in detail in Understanding the Linux Kernel. However, the book does not adequately
More informationWriting Client/Server Programs in C Using Sockets (A Tutorial) Part I. Session 5958. Greg Granger grgran@sas. sas.com. SAS/C & C++ Support
Writing Client/Server Programs in C Using Sockets (A Tutorial) Part I Session 5958 Greg Granger grgran@sas sas.com SAS Slide 1 Feb. 1998 SAS/C & C++ Support SAS Institute Part I: Socket Programming Overview
More informationOperating Systems Design 16. Networking: Sockets
Operating Systems Design 16. Networking: Sockets Paul Krzyzanowski pxk@cs.rutgers.edu 1 Sockets IP lets us send data between machines TCP & UDP are transport layer protocols Contain port number to identify
More informationbigbluebutton Open Source Web Conferencing
bigbluebutton Open Source Web Conferencing My favorites Project Home Downloads Wiki Issues Source Search Current pages for BigBlueButtonVM Download and setup your own BigBlueButton 0.81 Virtual Machine
More informationProcedure: You can find the problem sheet on Drive D: of the lab PCs. 1. IP address for this host computer 2. Subnet mask 3. Default gateway address
Objectives University of Jordan Faculty of Engineering & Technology Computer Engineering Department Computer Networks Laboratory 907528 Lab.4 Basic Network Operation and Troubleshooting 1. To become familiar
More informationIP address format: Dotted decimal notation: 10000000 00001011 00000011 00011111 128.11.3.31
IP address format: 7 24 Class A 0 Network ID Host ID 14 16 Class B 1 0 Network ID Host ID 21 8 Class C 1 1 0 Network ID Host ID 28 Class D 1 1 1 0 Multicast Address Dotted decimal notation: 10000000 00001011
More informationCourse Overview: Learn the essential skills needed to set up, configure, support, and troubleshoot your TCP/IP-based network.
Course Name: TCP/IP Networking Course Overview: Learn the essential skills needed to set up, configure, support, and troubleshoot your TCP/IP-based network. TCP/IP is the globally accepted group of protocols
More informationWhat is CSG150 about? Fundamentals of Computer Networking. Course Outline. Lecture 1 Outline. Guevara Noubir noubir@ccs.neu.
What is CSG150 about? Fundamentals of Computer Networking Guevara Noubir noubir@ccs.neu.edu CSG150 Understand the basic principles of networking: Description of existing networks, and networking mechanisms
More informationHardware Prerequisites Atmel SAM W25 Xplained Pro Evaluation Kit Atmel IO1 extension Micro-USB Cable (Micro-A / Micro-B)
USER GUIDE Software Programming Guide for SAM W25 Xplained Pro Atmel SmartConnect Prerequisites Hardware Prerequisites Atmel SAM W25 Xplained Pro Evaluation Kit Atmel IO1 extension Micro-USB Cable (Micro-A
More informationVirtual Systems with qemu
Virtual Systems with qemu Version 0.1-2011-02-08 Christian Külker Inhaltsverzeichnis 1 Image Creation 2 1.1 Preparations.................................. 2 1.2 Creating a Disk Image.............................
More informationCS335 Sample Questions for Exam #2
CS335 Sample Questions for Exam #2.) Compare connection-oriented with connectionless protocols. What type of protocol is IP? How about TCP and UDP? Connection-oriented protocols Require a setup time to
More informationNames & Addresses. Names & Addresses. Hop-by-Hop Packet Forwarding. Longest-Prefix-Match Forwarding. Longest-Prefix-Match Forwarding
Names & Addresses EE 122: IP Forwarding and Transport Protocols Scott Shenker http://inst.eecs.berkeley.edu/~ee122/ (Materials with thanks to Vern Paxson, Jennifer Rexford, and colleagues at UC Berkeley)
More informationRARP: Reverse Address Resolution Protocol
SFWR 4C03: Computer Networks and Computer Security January 19-22 2004 Lecturer: Kartik Krishnan Lectures 7-9 RARP: Reverse Address Resolution Protocol When a system with a local disk is bootstrapped it
More informationInternetworking and IP Address
Lecture 8 Internetworking and IP Address Motivation of Internetworking Internet Architecture and Router Internet TCP/IP Reference Model and Protocols IP Addresses - Binary and Dotted Decimal IP Address
More informationGiving credit where credit is due
JDEP 284H Foundations of Computer Systems Internetworking Dr. Steve Goddard goddard@cse.unl.edu Giving credit where credit is due Most of slides for this lecture are based on slides created by Drs. Bryant
More information2057-15. First Workshop on Open Source and Internet Technology for Scientific Environment: with case studies from Environmental Monitoring
2057-15 First Workshop on Open Source and Internet Technology for Scientific Environment: with case studies from Environmental Monitoring 7-25 September 2009 TCP/IP Networking Abhaya S. Induruwa Department
More information(Refer Slide Time: 02:17)
Internet Technology Prof. Indranil Sengupta Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Lecture No #06 IP Subnetting and Addressing (Not audible: (00:46)) Now,
More information