Data transfer between two applications using libUSB (host and target model) - data-transfer

I am trying to find a way to send and receive data over a USB connection connected using a cable. The idea is: A service/command line application will be running on target system, receives commands, and send data for the command. A GUI application sitting on the other machine analyses and interprets the data.
Using libUSB, is it possible?

If you try to connect to PC's together it will not be possible.
The USB protocol is a Master-Slave protocol. Most USB adapters only support either the Master mode or Slave mode. So you will not be able to connect two PC's with USB.
You would have to have special hardware on one of the PC's to act as USB slave.

Related

C Find Computer on LAN With Open Server

Im trying to figure out a way for one user to open a server, on a port of their choice, and for a user on the same LAN, to be able to see that server without manually putting in the ip and port. Think like when you open a minecraft LAN server, and people on the LAN can see the server, even though they never put in the ip, and the port is different every time. Is there a way to do this in c on linux with the Berkley Sockets API, with TCP sockets?
There's plenty of articles out there on how to use Unix built-in's to scan your Local Area Network for other hosts.
You can find your own IP address and Network using ifconfig, like in this article.
It's then a simple task to get a list of IP's/hostnames on your LAN using a command like nmap, and then sort through the output.
Here's an example:
sudo nmap -sn 10.84.32.54/24 | grep -Po "(\d{1,3}\.){3}\d{1,3}"
Which will return you a list of ip-addresses on your network like:
10.84.32.1
10.84.32.11
10.84.32.12
10.84.32.14
10.84.32.17
You could then go about scan each of the ports on these by running:
nmap -p- 10.84.32.1
To get an output like:
PORT STATE SERVICE
22/tcp open ssh
2581/tcp open unknown
2443/tcp open unknown

How do i know the hostname of my NTP server?

I set up a NTP server on my windows machine using the Meinberg Ntp server setup.
I think I have it working, but where do I find the name of the server so I can add it to the config file of the device I want to sync to the server?
You access all network services a computer hosts by its hostname or IP, independent of the protocol. Some services can also be registered in the DNS to make them "discoverable" but normally only networks of a certain size justify the effort involved in setting this up.
Simply determine the hostname of your computer and specify this as the ntp host on your device you want to sync. Perhaps the easiest way to get to the hostname is pressing lWindows + [Pause/Break][1], which shows you the system properties. Should work on most current Windows OSs.

How to establish a connection to a database using TCP?

I'm trying to establish TCP connection with PostgreSQL 9.1 server via Microsoft telnet. but When the connection has been establishe I received
Jconnector 3.6 1 ♥
What does it mean? Is it opssible at all to establish such connection manually to communicate the database via TCP?
When a TCP connection to a port is opened, what is listening on the Port sometimes announces itself: in this case, what is listening is Jconnector 3.6.1. The heart-shape is some binary data.
TCP connections tend to be only used by program code, as 'conversations' at that level quite often involve binary data. I don't know what Postgres does, but if you get it to run a select and return the data it will very likely be all binary and quire unreadable by a human.
If you search for what the wire-protocol is for Postgres, you may be able to make it do something via a telnet session, but expect you'd have a lot of difficulty.

Have TCP client search for TCP Server

Background
I am using a SparkCore wireless arduino board to connect to a local Node.js server. The server includes a local intranet TCP server that a TCP client programmed onto the SparkCore connects to.
Problem
If I run the server on a different network, the server has a different local IP address. When I do this, I have to reprogram the SparkCore arduino to tell it the new local IP address of the server to connect its TCP client to. This is not ideal for a variety of reasons.
Question
Is there a way to have the client dynamically search for the TCP server or alternatively have the server broadcast to TCP clients in a way that would inform the client of the local IP address to use for the server without initially hardcoding it? I would love to do this in way that did not involve iterating through a bunch of IPs on a specific port to see if a connection is made. That being said, if that's the only way to do this, then so be it.
How is the arduino booting? If it's booting using DHCP, one method would be to provide a customer DHCP option that provided the address of the node.js server. ntp, for instance, can configure itself in a similar way. This has the advantage that the arduino need not be on the same local subnet as the node.js server.
An alternative (slightly disgusting) would be to use an A record within your domain (let's say nodejs.example.com. Configure the local DNS recursive server to explicitly return this value (I am presuming you might have lots of different deployments with lots of different nodejs servers).
A third possibility would be to send out some form of discovery packet, either by broadcast, or better by multicast UDP. Assuming it's on the same LAN, the nodejs server could then reply. Clearly you might need to concern yourself with a rogue server impersonating your nodejs server, and therefore might need to add some security (e.g. use a shared secret, send a random nonce plus the nonce hashed with the shared secret to the server, the server checks the hash, and replies with the answer, the nonce, plus the answer hashed with the shared secret and the nonce, each of which the client then checks).

Data Catcher on a Server using port monitoring?

I am working on project where we may have 1,000's of pieces of hardware in the field all gathering data and reporting it back to a central server.
To get this data from sensor to database the hardware will be programmed with the server address to send it to. Data will be sent over http port 80. A json file will be encoded and pushed out via Ethernet where the server will intercepting, parsing and storing the data from each device based on device location and data structure.
My question is are there well defined ways to configure what I am calling the catcher? What sort of listening socket solutions should I look at?
I have done similar things in the past where data is sent via ftp to a server where I have a cron job (php script) running to look for new files in the destination folder and parse them into a database. This worked for 1 device but I want to do 1,000's.
Thoughts?

Resources