title
UDP Socket Programming in Java Tutorial
description
Check out our website: http://www.telusko.com
Follow Telusko on Twitter: https://twitter.com/navinreddy20
Follow on Facebook:
Telusko : https://www.facebook.com/teluskolearnings
Navin Reddy : https://www.facebook.com/navintelusko
Follow Navin Reddy on Instagram: https://www.instagram.com/navinreddy20
Subscribe to our other channel:
Navin Reddy : https://www.youtube.com/channel/UCxmkk8bMSOF-UBF43z-pdGQ?sub_confirmation=1
Telusko Hindi :
https://www.youtube.com/channel/UCitzw4ROeTVGRRLnCPws-cw?sub_confirmation=1
detail
{'title': 'UDP Socket Programming in Java Tutorial', 'heatmap': [{'end': 404.975, 'start': 388.968, 'weight': 0.761}, {'end': 529.315, 'start': 512.01, 'weight': 0.807}, {'end': 590.488, 'start': 573.889, 'weight': 0.715}, {'end': 834.487, 'start': 818.7, 'weight': 0.787}, {'end': 1217.123, 'start': 1188.326, 'weight': 1}], 'summary': 'This tutorial covers udp socket programming, communication, and data transfer in java, including implementing client-server communication, sending data to a client, and resolving udp data transmission issues, resulting in successful data transfer.', 'chapters': [{'end': 320.372, 'segs': [{'end': 54.385, 'src': 'embed', 'start': 22.81, 'weight': 2, 'content': [{'end': 27.194, 'text': 'you have to create a socket, you have to send data to the server and then server will do something for you.', 'start': 22.81, 'duration': 4.384}, {'end': 28.795, 'text': 'you will get the response.', 'start': 27.194, 'duration': 1.601}, {'end': 37.744, 'text': "so what we'll do is from a client machine, we'll send some, a number to the server and server will try to calculate the square of it.", 'start': 28.795, 'duration': 8.949}, {'end': 42.049, 'text': "okay, so we don't want any fancy operation here.", 'start': 37.744, 'duration': 4.305}, {'end': 45.22, 'text': 'is just that we need some simple operation.', 'start': 42.049, 'duration': 3.171}, {'end': 54.385, 'text': 'the main thing is that we need to understand how to send data from a client machine to the server machine using udp and then how to get the response.', 'start': 45.22, 'duration': 9.165}], 'summary': 'Setting up a socket to send data to server and receive response via udp for calculating square of a number.', 'duration': 31.575, 'max_score': 22.81, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/A5fFxs_DUsQ/pics/A5fFxs_DUsQ22810.jpg'}, {'end': 128.085, 'src': 'embed', 'start': 87.351, 'weight': 0, 'content': [{'end': 92.693, 'text': "so when you send data you don't have to mention to which server you want to send data, because you already have a connection.", 'start': 87.351, 'duration': 5.342}, {'end': 96.735, 'text': "but in UDP you don't have a connection.", 'start': 93.513, 'duration': 3.222}, {'end': 101.317, 'text': 'so every packet should know where it is going right.', 'start': 96.735, 'duration': 4.582}, {'end': 107.88, 'text': "so if you talk about TCP, it's a connection full protocol and UDP is a connection less protocol.", 'start': 101.317, 'duration': 6.563}, {'end': 111.601, 'text': "so UDP we don't know.", 'start': 107.88, 'duration': 3.721}, {'end': 113.022, 'text': "your packet don't know where to go.", 'start': 111.601, 'duration': 1.421}, {'end': 115.643, 'text': 'so your packet need to be mentioned.', 'start': 113.022, 'duration': 2.621}, {'end': 116.904, 'text': 'in your packet you have to mention that.', 'start': 115.643, 'duration': 1.261}, {'end': 120.802, 'text': "You have to mention the IP address and the port number, since we don't have a connection.", 'start': 118.101, 'duration': 2.701}, {'end': 124.604, 'text': 'But of course we need a socket there, right? So we cannot use normal socket here.', 'start': 121.522, 'duration': 3.082}, {'end': 128.085, 'text': 'To work with UDP, we require a special socket called as datagram socket.', 'start': 125.004, 'duration': 3.081}], 'summary': 'Tcp is a connection full protocol, while udp is connectionless. udp packets require ip address and port number, using a datagram socket.', 'duration': 40.734, 'max_score': 87.351, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/A5fFxs_DUsQ/pics/A5fFxs_DUsQ87351.jpg'}], 'start': 0.249, 'title': 'Udp socket programming', 'summary': 'Explains udp socket programming, highlighting differences from tcp, and demonstrates sending data from a client to a server using a practical example of calculating the square of a number.', 'chapters': [{'end': 320.372, 'start': 0.249, 'title': 'Working with udp sockets', 'summary': 'Explains how to work with udp sockets in socket programming, highlighting the difference between tcp and udp protocols, and the process of sending data from a client machine to a server machine, using a practical example of calculating the square of a number.', 'duration': 320.123, 'highlights': ['The chapter explains the difference between TCP and UDP protocols, emphasizing that UDP is a connectionless protocol. The chapter explains the fundamental difference between TCP and UDP protocols, highlighting that UDP is a connectionless protocol, which requires every packet to know its destination.', 'The process of sending data from a client machine to a server machine using UDP is detailed, including the use of a datagram socket and datagram packet. The chapter details the process of sending data from a client machine to a server machine using UDP, emphasizing the use of a datagram socket and datagram packet to specify the destination IP address and port number.', 'The practical example of calculating the square of a number on the server is demonstrated, involving the conversion of an integer variable into a byte array for data transmission. The chapter provides a practical example of calculating the square of a number on the server, demonstrating the conversion of an integer variable into a byte array for data transmission using UDP.']}], 'duration': 320.123, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/A5fFxs_DUsQ/pics/A5fFxs_DUsQ249.jpg', 'highlights': ['The chapter explains the difference between TCP and UDP protocols, emphasizing that UDP is a connectionless protocol.', 'The process of sending data from a client machine to a server machine using UDP is detailed, including the use of a datagram socket and datagram packet.', 'The practical example of calculating the square of a number on the server is demonstrated, involving the conversion of an integer variable into a byte array for data transmission.']}, {'end': 494.115, 'segs': [{'end': 351.368, 'src': 'embed', 'start': 320.372, 'weight': 0, 'content': [{'end': 322.153, 'text': 'so we have to pass two more parameters.', 'start': 320.372, 'duration': 1.781}, {'end': 329.139, 'text': 'the next parameter is the IP address and next parameter is the port number to make the IP address.', 'start': 322.153, 'duration': 6.986}, {'end': 331.681, 'text': "what we'll do is we'll use the advantage of INET.", 'start': 329.139, 'duration': 2.542}, {'end': 335.083, 'text': "I mean we'll use a class called as INET address.", 'start': 331.681, 'duration': 3.402}, {'end': 340.227, 'text': "we'll say AI equal to INET address.", 'start': 335.083, 'duration': 5.144}, {'end': 343.67, 'text': 'dot. get bytes are not get bytes.', 'start': 340.227, 'duration': 3.443}, {'end': 344.651, 'text': 'get localhost address.', 'start': 343.67, 'duration': 0.981}, {'end': 351.368, 'text': "Now, once you've got the localhost address, we can pass that AI here, because the server and the client are on the same machine.", 'start': 345.865, 'duration': 5.503}], 'summary': 'Using inet address class to get localhost ip for server-client communication.', 'duration': 30.996, 'max_score': 320.372, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/A5fFxs_DUsQ/pics/A5fFxs_DUsQ320372.jpg'}, {'end': 388.968, 'src': 'embed', 'start': 363.654, 'weight': 1, 'content': [{'end': 369.638, 'text': "Now once you've got the data we'll send the data we'll say ds.send that's how you send the data in this and this will pass dp.", 'start': 363.654, 'duration': 5.984}, {'end': 372.619, 'text': 'So dp is a packet you want to send.', 'start': 370.278, 'duration': 2.341}, {'end': 379.364, 'text': "so you're sending this packet dp through the socket.", 'start': 372.619, 'duration': 6.745}, {'end': 380.925, 'text': 'now, once you send the data.', 'start': 379.364, 'duration': 1.561}, {'end': 388.968, 'text': "of course we have send the data right and let's say on the server side, we have the data, we are processing it and we are doing all those stuff.", 'start': 380.925, 'duration': 8.043}], 'summary': 'Sending and processing data through a socket for server-side operations.', 'duration': 25.314, 'max_score': 363.654, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/A5fFxs_DUsQ/pics/A5fFxs_DUsQ363654.jpg'}, {'end': 417.278, 'src': 'heatmap', 'start': 388.968, 'weight': 0.761, 'content': [{'end': 392.91, 'text': 'after processing, your server will send you the response right.', 'start': 388.968, 'duration': 3.942}, {'end': 396.011, 'text': 'so you have to also accept it now, how do you accept the data?', 'start': 392.91, 'duration': 3.101}, {'end': 402.894, 'text': 'so again, for to accepting the data, we require a new datagram packet for accepting it and we are assuming that server will send you a data.', 'start': 396.011, 'duration': 6.883}, {'end': 404.975, 'text': "so we'll say datagram packet.", 'start': 402.894, 'duration': 2.081}, {'end': 408.234, 'text': "we'll say dp1, which will accept the data for you.", 'start': 405.933, 'duration': 2.301}, {'end': 410.995, 'text': "we'll say datagram packet again.", 'start': 408.234, 'duration': 2.761}, {'end': 417.278, 'text': 'now, when you accept data, we can use one more byte array, which will be helpful for accepting data.', 'start': 410.995, 'duration': 6.283}], 'summary': 'After processing, the server will send a response, requiring a new datagram packet and a byte array for accepting data.', 'duration': 28.31, 'max_score': 388.968, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/A5fFxs_DUsQ/pics/A5fFxs_DUsQ388968.jpg'}, {'end': 494.115, 'src': 'embed', 'start': 460.639, 'weight': 2, 'content': [{'end': 466.949, 'text': 'now, once you have specified this, Now we can directly receive the packet.', 'start': 460.639, 'duration': 6.31}, {'end': 472.779, 'text': 'So we can say ds.receive and we can receive that data into dp1.', 'start': 466.969, 'duration': 5.81}, {'end': 476.647, 'text': "So in dp1 you got the data and let's print that data.", 'start': 473.24, 'duration': 3.407}, {'end': 477.769, 'text': 'Now, how do you print it?', 'start': 476.847, 'duration': 0.922}, {'end': 487.491, 'text': 'we can say string str equal to new string, and we can write dp1.getdata.', 'start': 478.927, 'duration': 8.564}, {'end': 490.813, 'text': "that's how you can fetch data from the user.", 'start': 487.491, 'duration': 3.322}, {'end': 494.115, 'text': "now, once you got the data, let's print it on the system.", 'start': 490.813, 'duration': 3.302}], 'summary': 'Receive and print data using ds.receive and dp1.getdata.', 'duration': 33.476, 'max_score': 460.639, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/A5fFxs_DUsQ/pics/A5fFxs_DUsQ460639.jpg'}], 'start': 320.372, 'title': 'Udp communication and data transfer', 'summary': 'Explains the process of udp communication and data transfer, including the usage of inet address, sending and receiving data packets, and printing the received data.', 'chapters': [{'end': 494.115, 'start': 320.372, 'title': 'Udp communication and data transfer', 'summary': 'Explains the process of udp communication and data transfer, including the usage of inet address, sending and receiving data packets, and printing the received data.', 'duration': 173.743, 'highlights': ['The chapter explains the usage of INET address for specifying the IP address and port number for UDP communication, with the example of using localhost address and a specific port number like 9999.', "It details the process of sending data packets using the 'ds.send' method and passing the packet 'dp', highlighting the mechanism of sending data in UDP communication.", "The chapter elaborates on the process of receiving data packets using the 'ds.receive' method to accept the data into 'dp1' and printing the received data using the 'new String' method."]}], 'duration': 173.743, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/A5fFxs_DUsQ/pics/A5fFxs_DUsQ320372.jpg', 'highlights': ['The chapter explains the usage of INET address for specifying the IP address and port number for UDP communication, with the example of using localhost address and a specific port number like 9999.', "It details the process of sending data packets using the 'ds.send' method and passing the packet 'dp', highlighting the mechanism of sending data in UDP communication.", "The chapter elaborates on the process of receiving data packets using the 'ds.receive' method to accept the data into 'dp1' and printing the received data using the 'new String' method."]}, {'end': 697.181, 'segs': [{'end': 604.666, 'src': 'heatmap', 'start': 573.889, 'weight': 0, 'content': [{'end': 578.033, 'text': 'it will say throws, because your client will send a data to this port number right.', 'start': 573.889, 'duration': 4.144}, {'end': 579.654, 'text': 'so that port number should be working.', 'start': 578.033, 'duration': 1.621}, {'end': 582.177, 'text': "so that's why you have to mention the port number here.", 'start': 579.654, 'duration': 2.523}, {'end': 588.005, 'text': "now, once you mention the port number, we'll try to accept the data from the user now, from the client.", 'start': 582.177, 'duration': 5.828}, {'end': 590.488, 'text': 'so for accepting the data, we require datagram packet.', 'start': 588.005, 'duration': 2.483}, {'end': 597.116, 'text': 'so remember to send to, to use a socket we use datagram socket and to receive the data we require packets.', 'start': 590.488, 'duration': 6.628}, {'end': 599.519, 'text': 'or to send or receive the data we require packets.', 'start': 597.116, 'duration': 2.403}, {'end': 604.666, 'text': "so we'll say this is dp equal to new datagram package.", 'start': 599.519, 'duration': 5.147}], 'summary': 'Explanation of using port number and datagram packet for sending and receiving data.', 'duration': 92.656, 'max_score': 573.889, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/A5fFxs_DUsQ/pics/A5fFxs_DUsQ573889.jpg'}, {'end': 660.937, 'src': 'embed', 'start': 634.164, 'weight': 4, 'content': [{'end': 640.894, 'text': 'okay, now, once you create the packet using which you can, if you can receive the data, i mean we got the packet.', 'start': 634.164, 'duration': 6.73}, {'end': 642.937, 'text': "let's receive that, receive that data in the packet.", 'start': 640.894, 'duration': 2.043}, {'end': 646.502, 'text': "so we'll say ds.receive, and we can mention dp there.", 'start': 642.937, 'duration': 3.565}, {'end': 650.067, 'text': 'so in your dp now you will have your database coming from client.', 'start': 646.502, 'duration': 3.565}, {'end': 652.409, 'text': 'but i want to fetch the data from it right.', 'start': 650.828, 'duration': 1.581}, {'end': 656.113, 'text': 'so we have to create a string in which you can fetch the data.', 'start': 652.409, 'duration': 3.704}, {'end': 660.937, 'text': "we'll say new string and in bracket you can mention dp, dot, get data.", 'start': 656.113, 'duration': 4.824}], 'summary': 'Create a packet to receive data and fetch it using ds.receive and dp. then use new string and dp.getdata to fetch the data.', 'duration': 26.773, 'max_score': 634.164, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/A5fFxs_DUsQ/pics/A5fFxs_DUsQ634164.jpg'}], 'start': 494.115, 'title': 'Implementing client-server communication and datagram packet in java', 'summary': 'Covers creating a client and server for udp communication with a focus on setting up the server, as well as the usage of datagram packet and socket in java, including sending, receiving, and data manipulation.', 'chapters': [{'end': 588.005, 'start': 494.115, 'title': 'Implementing client-server communication', 'summary': 'Explains how to create a client and server for udp communication, including the necessary code and considerations, with a focus on setting up the server to accept data from the client and handling port numbers.', 'duration': 93.89, 'highlights': ['The server side is essential for completing the communication process, and the necessary steps to create a server for UDP communication are detailed.', 'Setting up the server involves creating a class for UDP server and specifying the main method with string arguments.', 'On the server side, a datagram socket is required to accept data sent from the client, and the port number needs to be specified to ensure proper communication.', 'Mentioning the port number when accepting data is crucial, as it ensures that the communication is directed to the correct port, thereby preventing exceptions.', 'The server must be able to accept data from the client, and this is achieved by specifying the port number and handling potential exceptions.']}, {'end': 697.181, 'start': 588.005, 'title': 'Datagram packet and socket in java', 'summary': 'Explains the usage of datagram packet and socket in java, covering the creation, sending, and receiving of data, as well as the conversion of string to integer and performing arithmetic operations.', 'duration': 109.176, 'highlights': ["The chapter emphasizes the requirement of datagram packet and socket for sending and receiving data in Java, with the creation of a new datagram packet using 'dp equal to new datagram package'.", 'It discusses the necessity of using a byte array while working with a datagram packet, demonstrating the creation and receiving of data in the byte array.', "The process of receiving data from the client using 'ds.receive' and fetching the data from the datagram packet using 'dp.getData' is explained, along with the conversion of the received data from string to integer using 'integer.parseInt'.", 'The chapter concludes with the requirement of performing an arithmetic operation, such as obtaining the square of a number received as input, and storing the result in an integer variable.']}], 'duration': 203.066, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/A5fFxs_DUsQ/pics/A5fFxs_DUsQ494115.jpg', 'highlights': ['The server side is essential for completing the communication process, and the necessary steps to create a server for UDP communication are detailed.', 'Setting up the server involves creating a class for UDP server and specifying the main method with string arguments.', 'Mentioning the port number when accepting data is crucial, as it ensures that the communication is directed to the correct port, thereby preventing exceptions.', "The chapter emphasizes the requirement of datagram packet and socket for sending and receiving data in Java, with the creation of a new datagram packet using 'dp equal to new datagram package'.", "The process of receiving data from the client using 'ds.receive' and fetching the data from the datagram packet using 'dp.getData' is explained, along with the conversion of the received data from string to integer using 'integer.parseInt'."]}, {'end': 831.986, 'segs': [{'end': 728.537, 'src': 'embed', 'start': 697.181, 'weight': 0, 'content': [{'end': 700.581, 'text': 'now I want to send this data back to the client.', 'start': 697.181, 'duration': 3.4}, {'end': 704.516, 'text': 'but hold on, how do you send data to client again?', 'start': 700.581, 'duration': 3.935}, {'end': 705.637, 'text': "that's a tricky part.", 'start': 704.516, 'duration': 1.121}, {'end': 717.227, 'text': "now, okay, uh, so to do that what we'll do is we require one more datagram packet which will send the data to the client side.", 'start': 705.637, 'duration': 11.59}, {'end': 722.332, 'text': "we'll say datagram packet dp1 equal to new datagram packet.", 'start': 717.227, 'duration': 5.105}, {'end': 728.537, 'text': "but while sending data you have to mention uh, you have to mention the port number, also right, but i don't know the port number here.", 'start': 722.332, 'duration': 6.205}], 'summary': 'Sending data back to client using datagram packet in a network communication process.', 'duration': 31.356, 'max_score': 697.181, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/A5fFxs_DUsQ/pics/A5fFxs_DUsQ697181.jpg'}, {'end': 831.986, 'src': 'embed', 'start': 785.397, 'weight': 1, 'content': [{'end': 787.838, 'text': 'but while sending you have to mention byte array.', 'start': 785.397, 'duration': 2.441}, {'end': 788.898, 'text': 'you have to send the length.', 'start': 787.838, 'duration': 1.06}, {'end': 795.433, 'text': 'you have to also mention the ip address, which is ia, and you have to mention the port number.', 'start': 788.898, 'duration': 6.535}, {'end': 798.075, 'text': 'so the port number will use the same port number for receiving.', 'start': 795.433, 'duration': 2.642}, {'end': 802.257, 'text': 'so the port number which we have used for receiving will use the same thing with a DP dot.', 'start': 798.075, 'duration': 4.182}, {'end': 803.758, 'text': 'get port.', 'start': 802.257, 'duration': 1.501}, {'end': 806.84, 'text': 'so get port will give you the receiving port number.', 'start': 803.758, 'duration': 3.082}, {'end': 815.946, 'text': "so we'll use the same port number and at the end we can simply say DS dot will use the same socket and will say send.", 'start': 806.84, 'duration': 9.106}, {'end': 817.447, 'text': 'we have to send DP 1 now.', 'start': 815.946, 'duration': 1.501}, {'end': 822.102, 'text': 'so we have received in dp and we are sending into dp1.', 'start': 818.7, 'duration': 3.402}, {'end': 823.062, 'text': 'this is that simple.', 'start': 822.102, 'duration': 0.96}, {'end': 825.403, 'text': 'so from the client side you are sending.', 'start': 823.062, 'duration': 2.341}, {'end': 826.323, 'text': 'you are creating a socket.', 'start': 825.403, 'duration': 0.92}, {'end': 828.464, 'text': "okay, first let's run this code.", 'start': 826.323, 'duration': 2.141}, {'end': 831.986, 'text': "i doubt it will work well, let's run this.", 'start': 828.464, 'duration': 3.522}], 'summary': 'Sending byte array with length, ip address, and port number for receiving and sending data.', 'duration': 46.589, 'max_score': 785.397, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/A5fFxs_DUsQ/pics/A5fFxs_DUsQ785397.jpg'}], 'start': 697.181, 'title': 'Sending data to client', 'summary': 'Discusses the process of sending data to the client using datagrampacket, including mentioning the port number, ip address, and length, as well as creating and sending a byte array.', 'chapters': [{'end': 831.986, 'start': 697.181, 'title': 'Sending data to client', 'summary': 'Discusses sending data to the client using datagrampacket, including the process of mentioning the port number, ip address, and length, as well as creating and sending a byte array.', 'duration': 134.805, 'highlights': ['To send data to the client, a new DatagramPacket is required to send the data to the client side, mentioning the port number, IP address, and length, and creating a byte array (b2) to send the data.', 'While sending data, it is necessary to mention the byte array, its length, the IP address, and the port number, and then use the same port number for receiving by using DP.dot.getPort().', 'The process involves creating a socket and using DS.send(DP1) to send the data to the client side, after receiving in dp and sending into dp1.']}], 'duration': 134.805, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/A5fFxs_DUsQ/pics/A5fFxs_DUsQ697181.jpg', 'highlights': ['To send data to the client, a new DatagramPacket is required to send the data to the client side, mentioning the port number, IP address, and length, and creating a byte array (b2) to send the data.', 'While sending data, it is necessary to mention the byte array, its length, the IP address, and the port number, and then use the same port number for receiving by using DP.dot.getPort().', 'The process involves creating a socket and using DS.send(DP1) to send the data to the client side, after receiving in dp and sending into dp1.']}, {'end': 1226.211, 'segs': [{'end': 891.792, 'src': 'embed', 'start': 856.044, 'weight': 0, 'content': [{'end': 858.746, 'text': 'It says number format exception for 8.', 'start': 856.044, 'duration': 2.702}, {'end': 859.446, 'text': "That's weird.", 'start': 858.746, 'duration': 0.7}, {'end': 864.689, 'text': 'Okay It is not able to convert that 8.', 'start': 859.466, 'duration': 5.223}, {'end': 873.694, 'text': 'Maybe because the way I am sending that data here is through Okay.', 'start': 864.689, 'duration': 9.005}, {'end': 878.183, 'text': 'Where is that thing? Okay, I guess it is also appending the string.', 'start': 873.894, 'duration': 4.289}, {'end': 880.045, 'text': 'Okay, this is not working.', 'start': 878.524, 'duration': 1.521}, {'end': 887.029, 'text': "So what we'll do is we'll use string.valueOf.", 'start': 880.065, 'duration': 6.964}, {'end': 890.871, 'text': 'If you pass i, it will give you the integer value.', 'start': 887.769, 'duration': 3.102}, {'end': 891.792, 'text': 'I think this should work.', 'start': 890.931, 'duration': 0.861}], 'summary': 'Encountered number format exception for 8, resolved by using string.valueof method.', 'duration': 35.748, 'max_score': 856.044, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/A5fFxs_DUsQ/pics/A5fFxs_DUsQ856044.jpg'}, {'end': 1086.936, 'src': 'embed', 'start': 1059.657, 'weight': 1, 'content': [{'end': 1063.498, 'text': "let's print this data first here before converting that number into string.", 'start': 1059.657, 'duration': 3.841}, {'end': 1072.42, 'text': "we'll say str plus str, so that we'll know what exactly the client is sending to the server and you can see, client is sending.", 'start': 1063.498, 'duration': 8.922}, {'end': 1075.525, 'text': 'Okay, use the client window.', 'start': 1074.344, 'duration': 1.181}, {'end': 1079.849, 'text': 'That is your server.', 'start': 1076.826, 'duration': 3.023}, {'end': 1082.352, 'text': 'Yeah, server is sending 8.', 'start': 1080.35, 'duration': 2.002}, {'end': 1084.954, 'text': 'You can see server is receiving 8.', 'start': 1082.352, 'duration': 2.602}, {'end': 1086.936, 'text': 'So there is no issue on this server side.', 'start': 1084.954, 'duration': 1.982}], 'summary': 'Server sent and received 8 without issues.', 'duration': 27.279, 'max_score': 1059.657, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/A5fFxs_DUsQ/pics/A5fFxs_DUsQ1059657.jpg'}, {'end': 1217.123, 'src': 'heatmap', 'start': 1188.326, 'weight': 1, 'content': [{'end': 1190.609, 'text': 'oh, that is the mistake.', 'start': 1188.326, 'duration': 2.283}, {'end': 1193.252, 'text': 'when we say length, it should be b1.', 'start': 1190.609, 'duration': 2.643}, {'end': 1198.159, 'text': 'right, we have searched everything and the problem was there.', 'start': 1193.252, 'duration': 4.907}, {'end': 1206.914, 'text': 'weird. right, if i change the data now to h and if i run this and if i run this Finally, we got 64..', 'start': 1198.159, 'duration': 8.755}, {'end': 1207.414, 'text': 'There was something.', 'start': 1206.914, 'duration': 0.5}, {'end': 1210.677, 'text': 'So you can see, right, that one mistake, it is leading to everything.', 'start': 1207.434, 'duration': 3.243}, {'end': 1211.678, 'text': 'Everything is going wrong.', 'start': 1210.837, 'duration': 0.841}, {'end': 1213.38, 'text': "So that's how you work with UDP.", 'start': 1211.998, 'duration': 1.382}, {'end': 1214.521, 'text': "And that's it from this video.", 'start': 1213.42, 'duration': 1.101}, {'end': 1217.123, 'text': 'I hope you enjoyed it with bugs and the things.', 'start': 1214.801, 'duration': 2.322}], 'summary': 'The mistake was corrected, resulting in a final data output of 64, demonstrating the impact of one error when working with udp.', 'duration': 28.797, 'max_score': 1188.326, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/A5fFxs_DUsQ/pics/A5fFxs_DUsQ1188326.jpg'}, {'end': 1222.167, 'src': 'embed', 'start': 1198.159, 'weight': 2, 'content': [{'end': 1206.914, 'text': 'weird. right, if i change the data now to h and if i run this and if i run this Finally, we got 64..', 'start': 1198.159, 'duration': 8.755}, {'end': 1207.414, 'text': 'There was something.', 'start': 1206.914, 'duration': 0.5}, {'end': 1210.677, 'text': 'So you can see, right, that one mistake, it is leading to everything.', 'start': 1207.434, 'duration': 3.243}, {'end': 1211.678, 'text': 'Everything is going wrong.', 'start': 1210.837, 'duration': 0.841}, {'end': 1213.38, 'text': "So that's how you work with UDP.", 'start': 1211.998, 'duration': 1.382}, {'end': 1214.521, 'text': "And that's it from this video.", 'start': 1213.42, 'duration': 1.101}, {'end': 1217.123, 'text': 'I hope you enjoyed it with bugs and the things.', 'start': 1214.801, 'duration': 2.322}, {'end': 1222.167, 'text': 'Since I have not run this code before, that was the one mistake I did.', 'start': 1218.024, 'duration': 4.143}], 'summary': 'One mistake led to everything going wrong in the code, resulting in 64 as the output.', 'duration': 24.008, 'max_score': 1198.159, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/A5fFxs_DUsQ/pics/A5fFxs_DUsQ1198159.jpg'}], 'start': 831.986, 'title': 'Server setup, client error, and udp data transmission', 'summary': 'Covers server setup, client error resolution using string.valueof method, and troubleshooting of udp data transmission issue, ultimately resulting in successful data transmission.', 'chapters': [{'end': 891.792, 'start': 831.986, 'title': 'Server setup and client error', 'summary': 'Details the process of running a server and client, encountering a number format exception error when sending data, and resolving it by using string.valueof method.', 'duration': 59.806, 'highlights': ['Encountered number format exception error for 8 when running the client.', 'Resolved the issue by using string.valueOf method to convert the data to integer value.']}, {'end': 1226.211, 'start': 893.773, 'title': 'Troubleshooting udp data transmission', 'summary': 'Discusses the troubleshooting process of a udp data transmission issue, where the data was not being transmitted correctly, leading to a wrong result, and the problem was identified as an incorrect length parameter in the data transmission process, ultimately resulting in the successful transmission of the data.', 'duration': 332.438, 'highlights': ['An error occurred during the transmission of data where the server was sending 8, but the client was receiving 6, indicating an issue with the data transmission process.', 'The debugging process involved checking the length of the data being sent, leading to the discovery of the mistake in the length parameter, ultimately resolving the data transmission issue.', 'The troubleshooting journey highlighted the critical impact of a single mistake on the entire data transmission process, emphasizing the importance of meticulous attention to detail in UDP data transmission.']}], 'duration': 394.225, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/A5fFxs_DUsQ/pics/A5fFxs_DUsQ831986.jpg', 'highlights': ['Resolved number format exception error for 8 using string.valueOf method.', 'Discovered and resolved data transmission issue between server and client.', 'Emphasized the critical impact of a single mistake on UDP data transmission.']}], 'highlights': ['The chapter explains the difference between TCP and UDP protocols, emphasizing that UDP is a connectionless protocol.', 'The process of sending data from a client machine to a server machine using UDP is detailed, including the use of a datagram socket and datagram packet.', 'The practical example of calculating the square of a number on the server is demonstrated, involving the conversion of an integer variable into a byte array for data transmission.', 'The chapter explains the usage of INET address for specifying the IP address and port number for UDP communication, with the example of using localhost address and a specific port number like 9999.', "It details the process of sending data packets using the 'ds.send' method and passing the packet 'dp', highlighting the mechanism of sending data in UDP communication.", "The chapter elaborates on the process of receiving data packets using the 'ds.receive' method to accept the data into 'dp1' and printing the received data using the 'new String' method.", 'The server side is essential for completing the communication process, and the necessary steps to create a server for UDP communication are detailed.', 'Setting up the server involves creating a class for UDP server and specifying the main method with string arguments.', 'Mentioning the port number when accepting data is crucial, as it ensures that the communication is directed to the correct port, thereby preventing exceptions.', "The chapter emphasizes the requirement of datagram packet and socket for sending and receiving data in Java, with the creation of a new datagram packet using 'dp equal to new datagram package'.", "The process of receiving data from the client using 'ds.receive' and fetching the data from the datagram packet using 'dp.getData' is explained, along with the conversion of the received data from string to integer using 'integer.parseInt'.", 'To send data to the client, a new DatagramPacket is required to send the data to the client side, mentioning the port number, IP address, and length, and creating a byte array (b2) to send the data.', 'While sending data, it is necessary to mention the byte array, its length, the IP address, and the port number, and then use the same port number for receiving by using DP.dot.getPort().', 'The process involves creating a socket and using DS.send(DP1) to send the data to the client side, after receiving in dp and sending into dp1.', 'Resolved number format exception error for 8 using string.valueOf method.', 'Discovered and resolved data transmission issue between server and client.', 'Emphasized the critical impact of a single mistake on UDP data transmission.']}