tanszek:oktatas:iss_t:integration_based_on_tcp_ip_sockets
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
tanszek:oktatas:iss_t:integration_based_on_tcp_ip_sockets [2023/03/06 07:54] – [Blocking and non-blocking TCP sockets in Java] knehez | tanszek:oktatas:iss_t:integration_based_on_tcp_ip_sockets [2024/02/25 15:43] (current) – [Blocking and non-blocking TCP sockets in Java] knehez | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ===== Socket communication ===== | + | ===== TCP - Socket communication ===== |
The client sends requests to the server over a TCP socket connection, and the server responds to these requests. Here are the basic steps involved in integrating software systems or components using TCP socket communication: | The client sends requests to the server over a TCP socket connection, and the server responds to these requests. Here are the basic steps involved in integrating software systems or components using TCP socket communication: | ||
Line 27: | Line 27: | ||
{{: | {{: | ||
- | Reading: | + | Blocking and non-blocking TCP sockets differ mainly in handling input/ |
+ | |||
+ | === Blocking sockets === | ||
+ | |||
+ | **Execution Flow**: In the case of blocking sockets, when a socket operation (like recv or send) is called, the program' | ||
+ | |||
+ | **Ease of Use**: Blocking sockets are straightforward to use and understand because the operations appear sequential and synchronous. The program will not proceed until the current operation finishes, simplifying the logic, especially for simple networked applications. | ||
+ | |||
+ | **Performance Considerations**: | ||
+ | |||
+ | === Non-Blocking sockets === | ||
+ | |||
+ | **Execution Flow**: Non-blocking sockets, on the other hand, allow the program' | ||
+ | |||
+ | **Complexity**: | ||
+ | |||
+ | **Performance and Scalability**: | ||
+ | |||
+ | Reading | ||
* http:// | * http:// | ||
Line 41: | Line 59: | ||
| | ||
- | | + | |
| | ||
Line 53: | Line 71: | ||
- | ===== Java examples ===== | ||
- | |||
- | [[Java example for Blocking and Non-Blocking Socket]] | ||
- | |||
- | ===== Exercises ===== | ||
- | |||
- | ** Exercise 1. ** | ||
- | |||
- | Create a simplified FTP (file transport) client and **blocking** server where the client can send or download text files from the server: | ||
- | |||
- | == General use-cases == | ||
- | -) Client connects to the server and sends a 'file listing' | ||
- | -) Server sends back the list of the downloadable files | ||
- | -) Client lists the files and asks the user what action they want to take? Upload or download? (' | ||
- | -) In both cases users must give the full file name with extension | ||
- | -) The client sends the selected file to the server (upload) or downloads the selected file from the server to a specific directory. | ||
- | |||
- | |||
- | == Server viewpoint == | ||
- | -) After connecting, it reads the files from the /store subdirectory and sends the file names to the client after receiving the listing message. | ||
- | -) We are waiting for the client' | ||
- | -) We get a filename from the client and if the action is ' | ||
- | -) If the operation is ' | ||
- | |||
- | == Client viewpoint == | ||
- | |||
- | -) The client connects and waits for the list of files coming back and writes it to the console | ||
- | -) We ask for the " | ||
- | -) Then we'll ask for the file-name as well. | ||
- | -) The client reads the files from the /files folder, or creates the downloaded file here | ||
- | -) If you press " | ||
- | -) If you press " | ||
- | |||
- | |||
- | ** Exercise 2. ** | ||
- | Modify the **blocking** UDP code so that you can transfer a burned-in name and existing text or image file larger than 2 kbytes and verify that it was successfully sent. | ||
- | ** Exercise 3. ** | ||
- | Try out the non-blocking starter Java code and examine/ | ||
tanszek/oktatas/iss_t/integration_based_on_tcp_ip_sockets.1678089245.txt.gz · Last modified: 2023/03/06 07:54 by knehez