P2P connection over wi-fi hotspot getting connected for same carrier but not for different carrier - p2p

P2P connection:
a) Over 3G network (both devices are on same operator), devices are unable to punch hole due to symmetric NAT.
b) However when I create hotspots using 2 devices (both devices are on same 3G operator) and connect other 2 devices to them, P2P is getting establish.
c) Also, if I take sim cards of different operator in case (b), P2P is NOT getting establish.
Can somebody explain why in case (b) devices are able to connect but not in case (c)?
Should not (b) also face same issue of symmetric NAT?

So I tried to connect 2 devices, connected to 2 different Wi-Fi. And failed when one wi-fi was behind firewall. I found out that issue was firewall, which was changing port (NAT).
May be carriers/operators put NAT thing when sending message to other operator/carrier. Due to which devices connect when SIM of same operator and not when of different carrier.
-Saur
[so I can't edit my comment after 5 mins...and I have lot to add. Also seems, "Enter" does not work in comments. So answering my own question. ]

Related

How to p2p_connect to device with WiFi Direct without MAC Address? (Raspberry Pi and Android)

I have an Android tablet and A Raspberry Pi and I want to established a connection between them automatically when the tablet sends a request to the Pi.
I followed an Android application example here and start discovering any nearby devices. (https://www.youtube.com/watch?v=qnY97iBxp30)
At the same time i run sudo wpa_cli and p2p_find 20. The Android application detects the Pi, and I try to establish connection with the Pi which will display
<3>P2P-GO-NEG-REQUEST TABLET_MAC_ADDRESS dev_passwd_id=4
Normally I would just p2p_connect TABLET_MAC_ADDRESS pbc to successfully connect them together but I find it inefficient if I were to swap to another mobile device.
Are there any other ways to connect the tablet without writing the tablet mac address? For example connecting to that specific device ssid when they send a P2P-GO-NEG-REQUEST to the pi?
TL;DR Nope.
If we look at the OSI ISO 7 layer model for network communication we can see that the Media Access Control (MAC) address is vital for identifying which device is which within a wifi network.
You could try setting up a bluetooth connection or a token-ring, but I suspect that would be more effort than you are looking for.
With IPv6 your devices could use neighbour discovery to automate past the MAC entry to the Internet Protocol, and its possible to connect between devices using their link-local address (fe80::some:thing)
Wifi carries packets of data, that have addresses. By analogy, if I tell you which town I live in, but don't write my building address on the packet, you are going to have a hard time delivering it.

Bluetooth Difference between pairing and paging, bonding

When I study Bluetooth, I am confused to understand Bluetooth connection and pairing, bonding, etc.
As far as I know, Bluetooth Connection has these steps:
Inquiry - discover
Paging - using the address in Inquiry process, process of forming a connection
Connection - device can participate actively(Active mode) or put into other mode(Sniff, Hold...)
When we use Bluetooth devices(e.g. Smartphone, Bluetooth Heaset)
it has these steps:
Discovery devices
Pairing(exchange other security information like address, PIN Code)
Connection start
I can't match paging to pairing. Is my understanding right below?
Inquiry = Discover Devices
Paging = Pairing
Connection = Connection start
How can I merge above two categories?
Not answered in 7-months! Oh, well for posterity...
Inquiry and Paging - Link Layer Connection
(Is there anyone out there? Hello!)
Inquiry and Paging are procedures and states of the Bluetooth Link Controller during the connection process.
The standard progression of states to a connection are as follows:
One device performs the Inquiry procedure, a request message for devices within 10-meters to respond, if they are in range. This device is the Master.
Devices that are discoverable, will respond with an Inquiry Response. Example: If you turn on the Bluetooth on your phone, it often states it is discoverable and then it will list a number of devices around you.
The Master device then will initiate a connection by paging a specific Slave device.
If the Slave device is amenable, it will respond with a Page response. Example: On your phone, you select the Bluetooth Headphones to connect with.
At that point lots of cool stuff happens so that the radios can match frequency hopping patterns and timing of radio packets. When it's over, and successful, you have a Link Layer connection.
Typically, there are two types of connection:
Asynchronous Connection-Less (ACL) - Packet data
Synchronous Connection Orientated (SCO) - Audio (or video) data, real-time.
Pairing
(security and remembering past lovers)
Bluetooth doesn't need any Security to do Service Discovery (the next stage) but all Bluetooth services need security, so pairing is nearly always done BEFORE Service Discovery BUT it doesn't have to be.
In the lowest level of pairing security, it 'just works'. Your phone says, it's connected and that's it. The link is encrypted but did you really connect to your headphones or your sister's down the hall?.
Once connected and encrypted like this, the phone may ask you if you want to stay paired with the headphones. If you select 'yes' or tick the box, your phone will remember the encryption and security keys for your headphones (as will your headphones for your phone). The next time they connect, they will recognise each other and just connect and encrypt the link without having to go through pairing again.
Now if your connecting your phone to your car by Bluetooth, you probably want better security. There are various options but typically it goes like this.
When it comes to pairing, your car system will display something like 'Pairing code 4753495' and your phone will display something similar like 'Verify pairing code 4753495 - Yes/No' - If they match, then you have a really secure connection and you absolutely know that your phone is paired with your car and not you're sister's rubbish Toyota out on the drive.
Bluetooth these days is really secure, the latest specs support US Secret Service levels of encryption and for that reason some Bluetooth firmware and devices have strict export restrictions. Older, legacy devices will still use 4-digit pin codes and are less secure.
Service Discovery
(What can you do?)
The Master will ask the Slave to tell it a little about itself and the Slave tells the Master all the cool things it can do. The Master will reciprocate too.
With our Headphones and mobile phone example, once you pressed on the Headphones in the list of devices, it will connect, pair and you will get a pop-up saying it supports things like 'Phone Media' (Handsfree / Headset Profiles) and 'Music Media' (Advance Audio Distribution Profile, Audio/Video Remote Control Profile, and some protocols under that).
Your car, in addition to Phone and Music Media, can probably do things like browse your Phone's contacts or even display text messages.
Profile/Service Connection
(Finally)
After all that, you're set up. Typically a profile/service level connection doesn't happen until you try and use it .e.g play music or make/receive a phone call but the Link Layer connection is there underneath.
So, you can start playing music on your phone and the sweet beats will magically come out of your headphones or car stereo...
Until your sister calls.

Can Two Bluetooth LE (4.0) Devices talk to each other?

Can Two Bluetooth LE (4.0) Devices talk to each other ?
A good example can be if two FitBit devices talk to each other .Just pass basic information ?
or One Coin Device communicate each to other ? (https://onlycoin.com/)
As of today we see most BLE Devices like fitbit communicate back to Iphone/Android Only .
Wont it be possible to have both FitBit deices communicate each other ?
I am thinking of creating a "Card 1: Bluetooth Card(LE 4.0)" which when Contacted with another "Card 2: Bluetooth Card(LE 4.0)" can exchange some date . After the exchange Card 1 will send the data it got from Card 2 to an IOS /Android device and the same applies to Card 2 . Is this possible at all ?
What you want to achieve is currently not doable. Bluetooth Low Energy (v4.0) only allows the star topology configuration, i.e. Only one master and multiple slaves; the master can talk to the slaves at the same time but the slaves cannot talk to each other. According to the Bluetooth website, they state:
"Bluetooth low energy technology uses a 32 bit access address on every packet for each slave, allowing billions of devices to be connected. The technology is optimized for one-to-one connections while allowing one-to-many connections using a star topology. With the use of quick connections and disconnections, data can move in a mesh-like topology without the complexities of maintaining a mesh network".
One way to achieve what you want is to switch roles between transmissions (i.e. the device that was once a slave then becomes a master) but this will be very complicated and many BLE chips do not support this feature.
I hope that this helps.

Ethernet + Serial port in Linux

I want to implement a driver in Linux, that has a Ethernet stack but the data going out on hardware will be a serial port. Basically, I want to register my serial port as a Ethernet driver. Does anyone have any idea if this is possible?
I want to be able to push IPv6 and/or UDP packets out of the serial port and in a similar way receive the packets via a serial port and pass it up the Ethernet stack.
I do not want to use the solution of serial-to-ethernet convertors(external hardware that convert a serial port to a ethernet port) but have that in my PC itself.
I tried PPP over the serial port and it works well. I am also told that I can do FTP, HTTP etc using the PPP. Reference to this - http://www.faqs.org/docs/Linux-HOWTO/Serial-Laplink-HOWTO.html
I have tried to hack the code from a RealTek Ethernet driver with a serial driver but not able to gain much success. Rather I do not know the stack of either to actually do anything meaningful. Any advice, guidance or tutorials would be helpful.
Thanks
Aditya
You need to get back to de basics on networking, the way I understand you question is: "I have a serial port and I want to use is an Ethernet link". Sorry to crush your dreams but you don't have the real hardware to do so, I'll elaborate on it.
A serial connection is a physical connection that requires 3 wires (at least) tx, rx and ground. On the logical side you have an IC that coverts binary data into signals that are represented by discrete voltage ranges.
Ethernet is a layer 2 protocol, the layer 1 is provided by the technology used to transmit the signals (coax, up, fiber etc.) As you might see by now, you need a different set of hardware to convert the logical Ethernet frames into a stream of digital numbers, in fact this is call framing.
Since Ethernet has been an easy to use protocol it has been implemented as e preferred protocol for many network operators, of course one of the biggest is PPPoE where you have a PPP session over an Ethernet link. Of course this won't work with your example neither since you're trying the opposite.
If you're just learning and have all the time in the world you can attempt to write your own Ethernet framer over serial lines. This means you need to implement IEEE802.3 into the driver and then you need to serialize the data to push it as a stream of bits over the serial line. Of course note the following drawbacks:
Your driver won't be able to fully support Ethernet, you need some support at hardware level to implement some signaling (example, auto negotiation, CSMA/CD, etc)
You driver will be pretty much useless unless you back in time where 115.2kbps is top speed in data transfers
IMHO there are more exciting projects that you can pick up in the networking field for device drivers. You can for example attempt to buy a NIC and develop the device driver for it from scratch and you can optimize certain areas. Finally, remember that most of the Ethernet implementations are now done in hardware so you don't have to do anything but filling a few registers on the MAC and voila!
SLIP and PPP do already what you want.

Is it right to send data in J2ME through cable by mean of DatagramConnection?

I want to send data by using J2ME between a mobile phone and a computer. The two machines are connected by the phone's cable : there is no Wi-Fi , no http connection , no Internet. So is it wrong or correct to use the J2ME DatagramConnection to send data to the computer when the mobile's cable is inserted to the USB port of the computer ?
When you talk about interaction between two systems, first you will need to address the connectivity. In the situation described, the connectivity between the phones is via USB, which is a serial port. So the communication can be done over serial port only.
Datagram can be used over IP networks and other specialized networks.
If for some reason you are unable to communicate via USB, check if you could connect both of them using Bluetooth. If your phone has Bluetooth and the computer doesn't, then you could purchase an USB Bluetooth Dongle for very cheap.
If you are trying to get logs of your application, you can check out Bluetooth loggers for J2ME. There are quite a lot of them. One such library is microlog
Hope this helps.
It depends, if you require high speed of data transfer while can bear some data loss then DatagramConnection is ok, and if you can't bear loss of data packets, then you should use TCPConnection.

Resources