network-programming

Is Serialization the best for sending data over a socket?

帅比萌擦擦* 提交于 2021-01-05 06:19:14
问题 Someone told me That Serialization was not the best way to send things over a socket but they said they read that in a book once and was not sure of a better way cause they haven't really done networking before. so is Serialization the best way or is there a better way. Also this is for a game if that makes much of a difference. What i see by searching questions about sending objects over it looks like most people use Serialization but im just checking to see what people thing 回答1: To

java.net.BindException: Cannot assign requested address (Bind failed) on LinkLocal rebind

↘锁芯ラ 提交于 2021-01-05 06:01:04
问题 I'm writing a Network Framework prototype in Java using UDP to deal with moments where a device using it might not have a permanent and/or reliable connection and how it should deal with it. It is required that I have to be able to use it with "normal" IPv4 and IPv6 addresses as well as IPv6 LinkLocal Addresses. Due to the concept there's moments where the device loses connectivity and i have to close all DatagramSockets binded to a specific IP/Port pair so i can free resources and, once the

Last few chars in a string sent over socket sometimes missing in Java network program

孤街醉人 提交于 2020-12-26 14:45:03
问题 Right now, I'm trying to write a GUI based Java tic-tac-toe game that functions over a network connection. It essentially works at this point, however I have an intermittent error in which several chars sent over the network connection are lost during gameplay. One case looked like this, when println statements were added to message sends/reads: Player 1: Just sent ROW 14 COLUMN 11 GAMEOVER true Player 2: Just received ROW 14 COLUMN 11 GAMEOV Im pretty sure the error is happening when I read

Last few chars in a string sent over socket sometimes missing in Java network program

一世执手 提交于 2020-12-26 14:40:50
问题 Right now, I'm trying to write a GUI based Java tic-tac-toe game that functions over a network connection. It essentially works at this point, however I have an intermittent error in which several chars sent over the network connection are lost during gameplay. One case looked like this, when println statements were added to message sends/reads: Player 1: Just sent ROW 14 COLUMN 11 GAMEOVER true Player 2: Just received ROW 14 COLUMN 11 GAMEOV Im pretty sure the error is happening when I read

Last few chars in a string sent over socket sometimes missing in Java network program

六月ゝ 毕业季﹏ 提交于 2020-12-26 14:30:46
问题 Right now, I'm trying to write a GUI based Java tic-tac-toe game that functions over a network connection. It essentially works at this point, however I have an intermittent error in which several chars sent over the network connection are lost during gameplay. One case looked like this, when println statements were added to message sends/reads: Player 1: Just sent ROW 14 COLUMN 11 GAMEOVER true Player 2: Just received ROW 14 COLUMN 11 GAMEOV Im pretty sure the error is happening when I read

Last few chars in a string sent over socket sometimes missing in Java network program

筅森魡賤 提交于 2020-12-26 14:30:04
问题 Right now, I'm trying to write a GUI based Java tic-tac-toe game that functions over a network connection. It essentially works at this point, however I have an intermittent error in which several chars sent over the network connection are lost during gameplay. One case looked like this, when println statements were added to message sends/reads: Player 1: Just sent ROW 14 COLUMN 11 GAMEOVER true Player 2: Just received ROW 14 COLUMN 11 GAMEOV Im pretty sure the error is happening when I read

Last few chars in a string sent over socket sometimes missing in Java network program

偶尔善良 提交于 2020-12-26 14:27:29
问题 Right now, I'm trying to write a GUI based Java tic-tac-toe game that functions over a network connection. It essentially works at this point, however I have an intermittent error in which several chars sent over the network connection are lost during gameplay. One case looked like this, when println statements were added to message sends/reads: Player 1: Just sent ROW 14 COLUMN 11 GAMEOVER true Player 2: Just received ROW 14 COLUMN 11 GAMEOV Im pretty sure the error is happening when I read

C# breaking out of XML reading function if XML file is no longer available

拈花ヽ惹草 提交于 2020-12-12 15:39:09
问题 I have a function that reads an XML page from a device attached to the network. The page is reached via url. The problem I'm having is that if I remove the device from the network while the function is parsing the XML page, the code freezes forever. How can I break out of the function if this happens? This is the code (the function returns a list of tags <example> ): public static List<string> GetTags(string xmlLocation) { //xmlLocation = http://192.x.x.x/xmlpage List<string> dataList = new

C# breaking out of XML reading function if XML file is no longer available

混江龙づ霸主 提交于 2020-12-12 15:38:25
问题 I have a function that reads an XML page from a device attached to the network. The page is reached via url. The problem I'm having is that if I remove the device from the network while the function is parsing the XML page, the code freezes forever. How can I break out of the function if this happens? This is the code (the function returns a list of tags <example> ): public static List<string> GetTags(string xmlLocation) { //xmlLocation = http://192.x.x.x/xmlpage List<string> dataList = new

Sending data with PACKET_MMAP and PACKET_TX_RING is slower than “normal” (without)

纵饮孤独 提交于 2020-11-30 06:21:30
问题 I’m writing a traffic generator in C using the PACKET_MMAP socket option to create a ring buffer to send data over a raw socket. The ring buffer is filled with Ethernet frames to send and sendto is called. The entire contents of the ring buffer is sent over the socket which should give higher performance than having a buffer in memory and calling sendto repeatedly for every frame in the buffer that needs sending. When not using PACKET_MMAP, upon calling sendto a single frame is copied from