Emulator TCP Packet Size - android-emulator

Has anyone tried to do a tcp client server app using the emulator using the pc as a server and the phone as the client?
I've got a bit of an issue where its only sending one packet, ie 1491 bytes of data regardless of how much there actually is to send, from the client(Phone) to the server(PC)
Thanks
James

1491 looks like it's related to the MTU (the maximum packet size supported by a protocol). The ethernet MTU is 1500.

Related

UDP traffic over LTE

I developed a C++ app to stream video from a webcam on an Odroid device over UDP. The client is an iPhone app using simple UDP sockets and it works perfectly over Wi-fi, but not over LTE. The sendto() call works okay, but the recvfrom() blocks forever. First I thought it has to do with iPhone blocking UDP traffic, but I also tried a client on my laptop connected in the iPhone's hotspot and thus over LTE.
Do you think there is something with phone providers blocking UDP traffic?
I preferred UDP instead of TCP for faster streaming.
Any advice would be highly appreciated!
Thanks!
UPDATE: I found the cause of the problem after some further inspection. It turns out that UDP over LTE sets the IP_MTU_DISCOVER flag and if the user's packet is larger than the device's MTU, it does not perform IP fragmentation but simply drops the packet. My application is sending packets larger than MTU, but in the case of Wi-fi they are fragmented in the IP layer. If you disable the IP_MTU_DISCOVER flag, the large packet is fragmented and arrives successfully in the destination. The other alternative would be to send packets smaller than MTU from the application. Both approaches do not perform that well, but at least the mystery is solved.

How to receive notifications of packet delievery status

I am now writing a program which should be able to dynamically select and switch 802.11 channels. Multiple threads can use a shared 802.11 radio. The goal is to let a thread lock the radio before switching channel, and then transmit one data packet, finally, unlock the radio after the data packet has been successfully transmitted out of the 802.11 NIC or dropped permanently.
But I can't find a way to know if a data packet has been transmitted out of the NIC card or it is still somewhere in the host. I am programming in C on Ubuntu. I use UDP socket to send the data packet. A successful return from "sendto" doesn't indicate that the data packet has been successful transmitted out of the hardware.
Could anyone point out a way to receive notifications of packet delivery status from 802.11? To sum up, I want to receive notifications when a data packet has been transmitted out of the NIC for broadcasting mode, and when a data packet has been successfully received by the other end or has been permanently dropped for unicast mode.
Any answer will be appreciated!

Which protocol (UDP or TCP) to use in streaming images wirelessly

Our project involves streaming captured pointCloud images from Xtion Pro Live to be transmitted wirelessly from a raspberry pi to a laptop. We propose to use UDP over TCP since UDP is faster than TCP. However, we also wanted to let the raspberry pi detect if it has lost its connection to the laptop. But since UDP is connectionless, here are the solutions that I can think of:
1.) Use TCP for detecting connection and UDP for streaming pointCloud
2.) Use UDP for streaming PointCloud and in the raspberry pi, it has to receive a frame from the laptop within a time window which this should serve as the detection for connection.
3.) Use TCP.
What should I use?
TCP, would be the most pragmatic option. Look how many images we receive on a single web page - that's all sent using TCP. There would be a lot more work required than detecting dead peers if you were to use UDP - you would also have to deal with dropped and duplicate packets, congestion control...

Broadcast data bytes through iPhone app

I want to broadcast some data bytes in particular wifi range through my iPhone app...so that every receiver in that particular range will receive that bytes. I am very much new to this concept.
Is there any sample app?
Thanks in advance...
This class is very interesting for doing socket in Objective-c, either UDP or TCP : http://code.google.com/p/cocoaasyncsocket/
Just send UDP packets to for instance address 224.1.2.3 which is a multicast address. I am not 100% sure where it will go, but if you disable 3G, at least then it should go to WiFi.

Using iPhone as a TCP and UDP server - open ports?

I need to send and get packets via UDP and TCP in iPhones and the server. But, I figured that if I wanna send packets to a client (iPhone), he is... A kinda server.
So, let's say I'm sending and getting packets to iPhone via the port 2347. Do I need to open the port on the iPhone or something like that? Is there any Firewall built-in to the iPhone?
No firewall on the iPhone. However, 99% of the time, the phone will not have a publicly accessible IP. It may be on wifi behind a router, or it may be on the cellular network most probably behind a NAT pool. Either way, you don't have access to any of those pieces of equipment, nor do your users in the cellular context (and potentially some cases of wifi usage). Think about doing this another way.
There is no firewall on the iPhone by default. Provided you don't need the iPhone to act as a server, i.e., bind a port, you can have the server send packets back to the iPhone using the information in which they were received, i.e., IP and port, using the protocol of your choosing, e.g., TCP or UDP.