packet

How to set the don't fragment (DF) flag on a socket?

感情迁移 提交于 2019-11-26 17:47:51
问题 I am trying to set the DF (don't fragment flag) for sending packets using UDP. Looking at the Richard Steven's book Volume 1 Unix Network Programming; The Sockets Networking API, I am unable to find how to set this. I suspect that I would do it with setsockopt() but can't find it in the table on page 193. Please suggest how this is done. 回答1: You do it with the setsockopt() call, by using the IP_DONTFRAG option:: int val = 1; setsockopt(sd, IPPROTO_IP, IP_DONTFRAG, &val, sizeof(val)); Here's

Android: Force data to be sent over radio vs WiFi

烈酒焚心 提交于 2019-11-26 15:58:30
问题 Is it possible to force an Android application to use only the mobile radio connection (3g/4g/etc), disallowing the use of WiFi? I think I want to use a HIPRI connection: (ex: WIFI turned on, use HIPRI 3G): http://groups.google.com/group/android-developers/browse_thread/thread/d41f85505484d29b 回答1: I don't believe you can "force" the connection path without explicitly turning off the Wi-Fi radio temporarily (not recommended). However, you could try setting the network preference during the

Identification of packets in a byte stream

孤街浪徒 提交于 2019-11-26 08:35:54
问题 I\'m having a bit of a problem with the communication to an accelerometer sensor. The sensor puts out about 8000 readings/second continuously. The sensor is plugged in to a usb port with an adaper and shows up as com4. My problem is that I can\'t seem to pick out the sensor reading packets from the byte stream. The packets have the size of five bytes and have the following format: High nibble Low nibble Byte 1 checksum, id for packet start X high Byte 2 X mid X low Byte 3 Y high Y mid Byte 4