C SC 481.20 Lecture 5: P2P and Sockets
major resource: Computer Networking (4th Edition), Kurose and Ross, Addison Wesley, 2008

[ previous | schedule | next ]

Peer-To-Peer (P2P) Applications and Protocols

Intro and Major Issues

BitTorrent to Illustrate Issues

Locating Content in a P2P Network

Sockets Programming for TCP

Overview of Sockets

Client protocol (typical):

  1. Request socket connection, wait for confirmation
  2. Send request over socket
  3. Wait for and receive server reply over socket
  4. Repeat send-receive cycle (steps 2 and 3) as required by application protocol
  5. Close socket connection

Server protocol (typical):

  1. Create a server socket to handle incoming connection requests
  2. Wait for incoming connection requests
  3. When request arrives, create a connection socket for communication (this leaves server socket free to accept additional connection requests)
  4. Receive client request over connection socket
  5. Send reply to client over connection socket
  6. Repeat receive-send cycle (steps 4 and 5) as required by application protocol
  7. Close connection socket

Simple Example Java client and server

End of Material for Exam #1


[ C SC 481 | Peter Sanderson | Math Sciences server  | Math Sciences home page | Otterbein ]

Last updated:
Peter Sanderson (PSanderson@otterbein.edu)