1 / 11

Client/Server Socket Programming Project

Client/Server Socket Programming Project. D-A0-1658 Dick D-A0-1623 Eddy D-A0-1611 Ricky. Concurrent connection-oriented server. Topic Simple ICQ program

Download Presentation

Client/Server Socket Programming Project

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Client/Server Socket Programming Project D-A0-1658 Dick D-A0-1623 Eddy D-A0-1611 Ricky

  2. Concurrent connection-oriented server • Topic Simple ICQ program • Communication between client and server (TCP) The server create socket and bind, the server will go to listen state, when client connect to server, if the server accept it, fork the slave process to serve the client, the client send request and slave process will respond to client

  3. Communication between client and server (TCP)

  4. Communication between client and client (UDP) • Client A want to send message to client B • Client A will send request of find address client B to server • Client A received address of client B address from the server • Then client can user UDP socket to send message to client B • Client B received message

  5. System Design • Server side windows • display client’s IP and port number, • “flag” to identify which process • when the server need to respond to client • it also display the system message

  6. System Design cont’ • Client side window • Client command window Communicate with server, choose operation and display • system message, such as login successful • Received message window • Display message from other client • Show the ID and IP who user send message

  7. System Design cont’ • the Server Side • The server only have TCP connection with user, the server is sitting at the MYPORT to waiting client request • When the client login to server, the server will verify the client information such as user id, pwd • All the client information will save at “list.dat” file,

  8. System Design cont’ • The file “list.dat” using structure • The client record struct record { int id; /* user id */ int pws /* user password */ char ip[15]; /* save the client ip */ int port; /* save the client receiving port */ };

  9. System Design cont’ • When the client A want to send the message to client B the client A first to use TCP socket to communicate to server request the client B address IP and port • Then the server will fetch the client B address and sent to client A, after the client A receive that message, then he can the UDP socket to send the message

  10. Defined application protocol • One protocol between the client and server TCP socket communication: structure icq struct icq { • int flag; /* identify which function client request */ int id; /* user id * / int pwd; /* user password */ int port; /* user port */ char ip[15]; /* user IP address */ }

  11. Defined application Protocol • Another protocol between client and client UDP socket communication: structure msg; struct msg { int id; char message[MAXDATASIZE]; }; • Variable statement ID –this ID number is the send message client user IDMessage– the char array contain message

More Related