| Start |
|---|
| A simple TCP echo back server Our TCP echo back server will be a separate thread. It's simple as its a start. It will just echo back whatever you send it but in capitalised form. Now to accept connections. Let's update the run method. Now if you can open telnet and try connecting You'll see a Welcome message. You must connect with the port you specified and IP Adress. You should see a result similar to this: Well, the connection was lost because we terminated it. Sometimes we would have to program our own TCP client. In this case, we need a client to request input from the user and send it across the network, receive the capitalised input. If the server sends data first, then the client must read the data first. Now update the server And now run the server and client, You should have an output similar to this RemarksThere are two types of Internet Protocol Traffic -
TCP is a connection-oriented protocol. TCP is suited for applications that require high reliability, and transmission time is relatively less critical. UDP is suitable for applications that need fast, efficient transmission, such as games. UDP's stateless nature is also useful for servers that answer small queries from huge numbers of clients. In simpler words - There is an absolute guarantee that the data transferred remains intact and arrives in the same order in which it was sent in case of TCP. |
Read Article
https://develop.horje.com/learn/1434/reference