1 00:00:01,350 --> 00:00:07,530 Since I've mentioned Wireshark several times in this course already, I've decided to create a bonus 2 00:00:07,530 --> 00:00:09,720 lesson to show you what the 3 00:00:09,720 --> 00:00:15,770 communication between our server and our client looks like in Wireshark. 4 00:00:15,950 --> 00:00:24,340 I'm going to run the first program we made - simple_tcp, and there's only one change we need to make, and 5 00:00:24,340 --> 00:00:30,420 it's going to be on the client side. Instead of connecting to the loopback address, 6 00:00:30,460 --> 00:00:38,110 We're going to connect to the network address of this host. To see what that address is, 7 00:00:38,110 --> 00:00:45,610 I'm going to use comment prompt. I'm gonna say "ipconfig" - and here we have the address. 8 00:00:45,610 --> 00:00:51,670 It's 10.0.2.15. Let's type that in. 9 00:00:56,870 --> 00:01:04,050 Save the code and then open Wireshark. 10 00:01:04,100 --> 00:01:14,000 I'm going to choose this adapter, and then I'm going to go back to Eclipse, run the server, and then run 11 00:01:14,120 --> 00:01:15,070 the client. 12 00:01:16,360 --> 00:01:26,260 When we open Wireshark, we can see our results. And I'm going to stop the capture. In the first few packets 13 00:01:26,260 --> 00:01:30,880 we can see the typical TCP connection being established. 14 00:01:30,880 --> 00:01:33,880 So this is called the "three way handshake". 15 00:01:33,880 --> 00:01:41,340 We have a SYN packet, and then SYN acknowledgement, and then another acknowledgement. 16 00:01:41,530 --> 00:01:49,870 The first packet that is actually a part of our protocol is this packet, and we can recognize it because 17 00:01:49,870 --> 00:01:57,030 it has this push flag turned on. When we look at what's in the packet, 18 00:01:57,040 --> 00:02:02,160 we can see this "Welcome!" message that we can recognize. 19 00:02:02,260 --> 00:02:08,190 And then when we look at the length of that message, it says 10 bytes. 20 00:02:08,290 --> 00:02:13,060 Let me show you what that 10 bytes actually is. 21 00:02:13,060 --> 00:02:23,000 It's actually "Welcome!" and then new line - or it's like this. 22 00:02:23,240 --> 00:02:29,320 One - two - three - four - five - six - seven - eight - nine - ten. 23 00:02:29,390 --> 00:02:34,600 So that's the ten bytes we're transmitting in this particular packet. 24 00:02:34,790 --> 00:02:43,970 Now regarding the push flag, when you go to the TCP part of the packet, we're going to look at the flags. 25 00:02:44,540 --> 00:02:49,810 And it tells us right away which flags are on. 26 00:02:49,850 --> 00:02:54,700 So it's the acknowledgement flag and the push flag. 27 00:02:55,040 --> 00:03:05,060 All the other packets don't have the push flag, they are anyway just SYN, acknowledgement and FIN packets, 28 00:03:05,270 --> 00:03:09,910 which are a regular part of any TCP connection. 29 00:03:09,980 --> 00:03:14,060 Let's find our reply from the client. 30 00:03:14,070 --> 00:03:15,480 It's "Thanks!" 31 00:03:15,590 --> 00:03:18,050 And that's the entire communication. 32 00:03:18,070 --> 00:03:26,450 So the session was opened, we sent "Welcome!" and then we sent "Thanks!" back and then we closed the socket, 33 00:03:26,480 --> 00:03:31,280 which initiated the termination of the TCP connection.