Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I'm trying to build a program in c++ to see what game servers a client is connected to for a gaming site. For the program we need to be able to see if a client is connected to a specific server or not. I've tested using wireshark and this program can see the incoming/outgoing connections to and from the server - which is the exact thing I need but i'm just not sure how to do it. I understand you can see which port connections are going in and out through using command prompt using netstat, but netstat doesnt give the details i'm after. All I need to be able to do is basically scan through their outgoing connections and compare it to an IP, and if the IP matches then they're connected to the server.
Is this possible through c++? If not, does anyone know how wireshark does it?
Cheers.
This depends on your operating system and is different in Windows and Linux.
In Linux you can get all of the information about a program's sockets using lsof -p [PID] where PID is the program's PID.
To do this in your own program look up the lsof source code and see how it is done. As I recall, it is done by reading files in /proc.
In Windows you could try C++ Get Handle of Open Sockets of a Program
Check out libpcap http://www.tcpdump.org/
You may need to deconstruct the UDP/TCP packets themselves.
If you want a simpler solution you could pipe the output of tcpdump as stdin. You can give tcpdump filter to ensure your application isn't spammed with useless content.
Related
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 3 years ago.
Improve this question
Device: Arduino Nano
Processor: ATmega328p
Programmer: AVRISP mkII
Port: COM5 USB 2.0
When I'm trying to upload sketch, it's saying
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0xec
And it's trying to do this 10 times, and then saying
avrdude done. Thank you.
Problem uploading to board. See http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions.
The possibility for this message can be so much, that it is impossible to say why this happens.
Just a note:
If you are uploading it with the normal COM, you don't need to write the programmer type. It is used if you are uploading it with the ISP interface.
So the questions are:
- are you using a programmer for the Arduino nano? Why?
The nano has already a bootloader, so you can just upload your sketch over the COM port.
Some times, the serial port isn't able to send the reset signal. Some times it is just not connected. If this is the case, you can press the "RESET" button when you see it is trying to upload the sketch.
Some times, you just have a clone. So don't have to select a nano but a mini pro if you want upload your sketch without errors.
In this case, I think you are just trying to upload the sketch with a programmer even if you don't have one connected... But I am not sure.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I'm trying to find a proper way how to reuse existing implementations of wifi tools(iw) in own code(c\c++). I need to get information about available AccessPoints in range(signal strength, mac addr., etc). I found couple example codes(WEXT and others) that uses ioctl approach, but it makes passive scans(and i get new information only once in two minutes in my network)[UPDATE1: Thanks to #fluter, i know that WEXT can do active scanning, too.]. I found that iw makes an active scan and that is what i need. So my question:
Is there a way to use iw code in my own app without parsing its source code in chunks, or, maybe, there is an Wireless API for such purpose?
(UPDATE1: with basic code examples to start with.)
Similar question
UPDATE2: I have reviewed my task and found that AP information is not enough for me, i need to capture clients data, too. That leads me to wifi packet sniffing and the best tool i have found to do that is Horst. So, i'm trying to reuse its code in my app, now.
You might wish to start with cfg80211.
cfg80211 replaces Wireless-Extensions and it is suggested that :
All new Linux wireless drivers should be written targeting either cfg80211 for fullmac devices or mac80211 for softmac devices.
Also, it is written:
Instead of writing wext ioctls you now write cfg80211 operation
callbacks and fill in the wiphy struct to indicate to cfg80211 its
device capabilities.
To start with active scanning start here
You can use the wext api provided by kernel, basically, call ioctl with SIOCSIWSCAN, and get the scanned result with SIOCGIWSCAN.
You can set to scan all by using flag IW_SCAN_ALL_ESSID, and choose scan type with flag IW_SCAN_TYPE_ACTIVE or IW_SCAN_TYPE_PASSIVE.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I'm looking to create a mobile app on IOS devices before I started I just needed to check up on one thing. How can I detect other IOS mobile devices within local rage e.g same room, same train, etc..
I want to be able to do it while the phone is locked, so bluetooth wouldn't be a great example as most people have it turned off.
Thanks!
The application has to send its location to the server.
Then the server knows where every devices that shared its location are.
Then your application can ask "who is around?" to your server... and your server calculates (let's suppose within a radius of 2 miles) who is around... and sends back to you.
It doesn't have anything to do with bluetooth. It's done via regular internet.
For other users of your app who want to be discovered you could use Bluetooth LE and the new iBeacon support added in iOS 7. Each user would have to launch your app and give it permission to start "advertising" their presence. However, the range of Bluetooth LE is like 10-20 meters (I forget the exact figure) and that will go down in "RF hostile" environments.
If everybody's connected to the same WiFi network you could use Bonjour.
Another option, as suggested by Wagner, above, is to have the devices send their locations to a central server.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
So, I read the manual three times, installed the Oracle service pack two times, tried to access five different virtual machines dozens of times with all kinds of authentications, followed every thread on this forum, all to no avail. I really did everything there is to do to my knowledge. But accessing Virtualbox regardless of the OS does not work in version 4.1.23. Two things seem just really bad:
The manual tells at no point WHERE on OSX the VBoxManager commandline tool is installed. But the manual references it dozens of times. It's on no search path in none of the shells I am using. Doing a find / -name "VBoxManager" as root reveals there is no such tool anywhere. Please, can someone let me know what to do to actually be able to do what the manual says with regard to the command line? Where does one get that tool?
I still would like to learn how one accesses a virtualbox installation with a remote screen. Here is what I tried;
as clients:
Apple Remote Desktop
Fails to find server
Apple VNC protocol from Finder
Fails to find server
VNCViewer (even though that is as unlikely to work for RDP as option 2)
Fails to find server
Microsoft Remotedesktop (that should work).
Fails to authenticate, after hitting the connect button one gets instantly the response that authentication failed, regardless of
means of authentication, such as NULL, External
Network interface (bridged, NAT)
IP address (the one the virtual machine obtains, localhost, my own host's ip address)
Port (tried different ports none of which were occupied)
Virtual OS (Windows 7, Windows XP, CentOS 6.3, ClearOS, backtrack 5)
Please, can someone help?
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
I need something a little more feature rich than Sysinternals TCPView (which I regularly use) ... but it also must be freeware. :)
Well, the question is a bit old and I realize that probably you already found the software you were looking for... just in case, an interesting connection monitor utility is CurrPorts, by Nir Sofer.
Freely adapted from the program's home page:
displays the list of all currently opened TCP/IP and UDP ports on your local computer;
for each port in the list, information about the process that opened the port is also displayed, including the process name, full path of the process, version information of the process (product name, file description, and so on), the time that the process was created, and the user that created it;
allows you to close unwanted TCP connections, and kill the process that opened the ports;
allows custom filters for inclusion/exclusion of connections.
Maybe a full blown traffic sniffer like Wireshark will complement your tool set?
Amongst wiresharks features are:
packet analysis
traffic statistics
capture
coloring
data export
I recommend TCPView for Windows v2.53.
image http://i.technet.microsoft.com/bb897437.TcpView(en-us,MSDN.10).gif
TCPView is a Windows program that will show you detailed listings of all TCP and UDP endpoints on your system, including the local and remote addresses and state of TCP connections. On Windows Server 2008, Vista, NT, 2000 and XP TCPView also reports the name of the process that owns the endpoint. TCPView provides a more informative and conveniently presented subset of the Netstat program that ships with Windows. The TCPView download includes Tcpvcon, a command-line version with the same functionality.
Not sure what features you are looking for so this is my suggestion.
Without having used it, I have seen TCPStat advertised a few times.
It looks like it was a discontinued project somewhere around 2003 and it's an awful blue color.
There's the MS Network Monitor.
Process Hacker shows also send/receive bytes, speed, country flag etc.