If no packet in air, why pcap_next_ex() is not returning anything? - winpcap

I am working on a sniffer. I am using WinPcap library in it. I am using a pcap_next_ex API to get the packets, I am calling this is in a infinite loop from the from application. When I configure sniffer in 56 channel, there are no packets in air, so this API is not returning anything. so that application is hanging. Why it is not returning anything?

Related

Listening for all incoming packets to a certain network interface using Boost/ASIO

I was looking all over the internet to find a way to capture incoming packets from a certain network interface, then I came across PCAP, TCPDUMP, I believe the most commonly used networking library out there is Boost/Asio, so I wanted to use this library in order to capture traffic, but apparently there is no example for using Raw sockets or other classes to listen for incoming packets to a certain NI, I would appreciate any help or examples on this.
We eventually found out the best option for sniffing incoming packets was Libtins.
libtins is a high-level, multiplatform C++ network packet sniffing and crafting library.
Its main purpose is to provide the C++ developer an easy, efficient,
platform and endianness-independent way to create tools which need to
send, receive and manipulate network packets.
It uses a BSD-2 license and it's hosted at github.

WebRTC Video Streaming fails through Airtel Broadband, works fine with 4G Hotspot

I am trying out the WebRTC examples of MuazKhan. It is working perfectly fine when the broadcaster is on AWS/Azure(or any other network) and the receiver is through my phones 4G network. But as soon as I switch to my broadband from 4G, the video stream is unable to connect and I the video player keeps on trying. Therefore I assumed that the problem is of the router NATting and will be resolved if I use a tried-n-tested TURN service such as Xirsys.
Sadly, even after using their TURN servers, I still am blocked with my broadband connection issue as mentioned above. Here are a few queries that I wanted to discuss:-
This issue seems to be due to NATting through my broadbands routers. Shouldn't using the TURN server solve it?
How can I verify if even the TURN servers are getting used and its not just the STUN servers.
Can this issue be due to the Signalling Server?
Do i need to enable some specific protocols in my router to make this work?
What else could be responsible for the issue that I should debug?

Reverse Engineering HTTP API between iOS device and wifi device on same network

I have a device that connects wirelessly to my network. This deivce has a dedicated iOS app but it hasnt been updated in a while and I worry it is no longer supported/updated and therefore it will eventually stop working.
What I would like to do it try to capture the data between the app and the device and reverse engineer the API so write my own app.
I can see that the device has port 8080 open so I am hoping that it is a HTTP based API but on a non standard port.
Ive looked and both Fiddler and Postman but cant quite seem to work out whether their proxy will capture the data from from port 8080 or just 80/443.
Any thoughts how to do this?
Thanks

Live streaming audio with WebRTC browser => server

I'm trying to sent some audio stream from my browser to some server(udp, also try websockets).
I'm recording audio stream with webrtc , but I have problems with transmitting data from a nodeJS client to the my server.
Any idea? is it possible to send audio stream to the server using webrtc(openwebrtc)?
To get audio from the browser to the server, you have a few different possibilities.
Web Sockets
Simply send the audio data over a binary web socket to your server. You can use the Web Audio API with a ScriptProcessorNode to capture raw PCM and send it losslessly. Or, you can use the MediaRecorder to record the MediaStream and encode it with a codec like Opus, which you can then stream over the Web Socket.
There is a sample for doing this with video over on Facebook's GitHub repo. Streaming audio only is conceptually the same thing, so you should be able to adapt the example.
HTTP (future)
In the near future, you'll be able to use a WritableStream as the request body with the Fetch API, allowing you to make a normal HTTP PUT with a stream source from a browser. This is essentially the same as what you would do with a Web Socket, just without the Web Socket layer.
WebRTC (data channel)
With a WebRTC connection and the server as a "peer", you can open a data channel and send that exact same PCM or encoded audio that you would have sent over Web Sockets or HTTP.
There's a ton of complexity added to this with no real benefit. Don't use this method.
WebRTC (media streams)
WebRTC calls support direct handling of MediaStreams. You can attach a stream and let the WebRTC stack take care of negotiating a codec, adapting for bandwidth changes, dropping data that doesn't arrive, maintaining synchronization, and negotiating connectivity around restrictive firewall environments. While this makes things easier on the surface, that's a lot of complexity as well. There aren't any packages for Node.js that expose the MediaStreams to you, so you're stuck dealing with other software... none of it as easy to integrate as it could be.
Most folks going this route will execute gstreamer as an RTP server to handle the media component. I'm not convinced this is the best way, but it's the best way I know of at the moment.

C2DM Behavior over Wifi and 3G

I'm developing an app which relies on C2DM to be notified of some new data to be fetched from a REST service. I have successfully implemented the C2DM android feature, but the behavior over Wifi is different from the connection over 3G. The messages are received instantly over 3G, but I have to manually turn Wifi off and on to have a "grace period" of ~1 min in which I receive them instantly.
My question is: Is there any way I can programmatically restart the connection, or trigger the notification fetch?
EDIT:
I've implemented an AsyncTask that periodically "reassociates" the connection to the access point (using WifiManager.reassociate()) every minute and a half. Not so sure about the correctness of this solution, though.
I've seen similar issues. It seems that under some circumstances C2DM messages are not delivered over wifi connections, when they are over 3G. On a related note I've also seen Android devices "drop" the push connection, so messages are not delivered (in my case the solution can be to put the device in airplane mode and then turn the network back on).
This reinforces the fact that all applications that use C2DM should be built so that even if push messaging fails, the app still works (even if messages/updates are slower because there's occasional polling to the server)
I wouldn't personally want to mess with the wifi connection as that's something that may cause problems for the user.