How to list available ports with boost ASIO? - boost-asio

I'm trying to use Boost.ASIO Library, And I could not find how to list available ports(with serial port service) or sockets (with the network service) of boost.
Do you know if this is possible ?
Thank you.

Boost.Asio does not provide this functionality. Generally, this information is platform dependent. For example, on Windows, one might use Winsock LSP/SPI for sockets and SerialPort.GetPortNames for serial ports. While on Linux, /proc/net/* directories list sockets and serial ports will be enumerated within /sys/class/tty .

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.

how to transmit serial data from GPS device to computer through IP?

Well..I have found some third party application regarding sending data from com port to IP. but I have not found any basic tutorial regarding them. so can anyone help me with this? I have a GPS device which I will connect to my laptop through usb to serial adapter.Now I need to send that data from a laptop to another laptop on same network. Can I use putty to view that data in another laptop(receiver)? Is virtual serial port driver meant for this kind of application?
If you do not want to write your own tool for it, you can simply use ncat and set up a daemon that reads piped data from one process and broadcasts it to all connected clients.
If you want something that reads the data from the serial port and then transmits it to clients, you'll need to write a server application that accepts connections and sends data around, but there's entire books on this. It should be easy to do for your purposes as written here, but it depends on the amount of control you need.
Alternatively you can use a virtual serial port application as you had mentioned, which might be the easiest route. The two devices will need to be on the same network unless the application supports TCP based virtualization instead of the common Ethernet based implementation.
This Python script works very well as a free "device server". Just enter the serial port configuration and the IP address and port information.
https://github.com/jaredly/pydbgp/blob/master/symbian/serial_tcp_redirect.py
This can work on both Windows and Linux.
You need pyserial.
You can always try using stand alone hardware such as the SENA LS100 device server.

Can NS3 EMU be applied on different machines in WAN?

we are currently considering whether ns3 satisfying our requirements, we're looking for a convenient tool to run in distributed devices in the real network (every kind of possible connections) and capture the network performance data (like a sniffer). I realize that the primary purpose of ns3 is to simulate network topology in a single machine, but its emu module sounds promising and the flow monitor can save our effort on data capture.
In the following link
http://www.nsnam.org/wiki/HOWTO_make_ns-3_interact_with_the_real_world
it is declared that NS-3 EMU can be applied to inject simulated nodes interacting with real live network, and 3 kinds of testbed are given. However the first solution, virtual machine vmware testbed is still woking within LAN -- in promiscuous mode the virtual machines network card are listening to all LAN broadcasts so that the emu-udp-echo server and client can find each other.
My question is, is it possible that the emu-udp-echo server/client running in different, physical systems from different positions in wide network?
e.g. in different cities or from different network providers, given ip address of the hardware where the other ns-3 node is running? if it is possible, how can i specify the "real" ip address and port for the node, instead of assign a virtual ipv4 address?
Thanks a lot.
Yes, while the documentation describes how to perform this using virtual machines, this can be done in general on real hardware. Since that HOWTO was written, there has been additional work on providing helpers for running this type of experiment, including running on PlanetLab testbed machines. This documentation describes the generalized file descriptor NetDevice, added to the ns-3.17 release: http://www.nsnam.org/docs/release/3.19/models/html/fd-net-device.html. A similar example to the one described in that HOWTO is found in the file fd-emu-udp-echo.cc.
When using emulation mode on real networks, configuration of the MAC addresses and IP addresses must be done carefully. First, the device must be able to be put into promiscuous mode. Second, the MAC address needs to be different than the hardware address of the NIC. If you intend to be riding on top of an active NIC with existing IP address (in use for other Internet traffic), you'll need to have another IP address for ns-3 that is within the right link subnet. If instead you want to dedicate the NIC to ns-3 use, then do not assign the IP address to the host NIC and just assign it to the ns-3 configuration.
The PlanetLab example also shows another configuration that uses Tap devices to send data to/from PlanetLab testbed nodes. Some of this configuration is specific to how PlanetLab works, but the use of Tap device bridged to an ns-3 device may also facilitate emulation.

uPNP - handling changes to local IP address

I boot my laptop w/o a LAN connection and get the link-local address 169.254.1.1
My local uPNP clients/servers start discovering one another and communicating.
Now I connect to my LAN and DHCP assigns me a proper routable IP address 10.0.0.4.
I would like my uPNP clients and servers to start interacting with others over the LAN.
Do all my clients and servers need to be written to detect this situation and restart their uPNP sessions or is there a better way? For example, is there a uPNP s/w libary that supports IP address changes internally?
thanks,
r
ohNet will detect changes in IP address and update devices, including switching them between network interfaces. Its a C++ library with bindings for C#, Java and C clients. It is liberally licensed and has ports available for desktop and mobile platforms.
Disclaimer: I'm not entirely unbiased here - I maintain the project.

board with webserver, email, snmp

I am looking for board, module, kit for our new project.
requierments:
necessary:
IP interface IPv4/IPv6
DHCP, StaticIp, ICMP(Ping)
SNMP V2, V3
HTTP, Webserver
Email
good to have:
Telnet
SSH
SysLog
There are two ways:
complete controlled modul + master(some 8-bit with rs232, spi, ..)
I've found this http://www.connectone.com/products.asp?did=73&pid=92
But there is probably problem with SMTP, it isnt direct supported. Only UDP.
some board with linux
Thanks for your advices and recommendation.
with such heavy requirements, i would definitely go for an embedded computer running linux or a lighter unix based kernel. it will give you some flexibility over the software package, and you will easily find some support.
(there are plenty of embedded computers on the market, i can't chose one...)
I've found this XPORT PRO from LANTRONIX.
http://www.lantronix.com/device-networking/embedded-device-servers/xport-pro.html
There is Linux, so all 'net' stuffs should be supported.
8MB SDRAM/16MB Flash
small, cheap
Do you have some experience with that?
The second tip is http://www.rabbit.com/
Very powerfull modules with C libraries.