Is there a way to have two instances of my UWP app running on two devices communicate with each other using a USB cable? I was looking at UsbDevice and the MSDN tutorial for bulk transfers, but I can't seem to find a way to connect two computers. It looks like it's just for storing files on "regular" USB devices.
So, is there a way to send messages through a USB cable connected to two computers from one instance of an app on one computer to another one on another computer?
If you take #Turbo J's suggestion of using Ethernet, one option would be to use sockets and use some form of data serialiasation - e.g. JSON (with JSON.net), though you'd have to find a way of getting the hostname of the remote computer hosting your app
Related
this is my first question here, after searching and reading through many places I have not choice but to ask.
I have a C# application that receives data from a GPS device and stored in a database, I need now is to send a string that contains commands which the device should be interpreted.
This device connects to the Internet over GPRS, I haven't idea how to send this packet over TCP over GPRS because the IP is dynamic.
I hope any suggestions or ideas on how to solve this.
Best regards.
You should do it the other way around - the device should poll the server for instructions. Just make sure the server is accessible.
As you have specified that you have developed a C# application to read the GPS data through GPRS that means you are running C# application on a public/static IP.
Nwo as soon as you get a request from the GPRS client, you get the DHCP IP address of the remote endpoint too.
Once you have that endpoint and socket open, you can transmit any data to the GPS device back.
Assuming that your GPS device is having some microcontroller to drive the GSM/GPRS modem.
I'm going to make an assumption here that the 'Device' is some kind of mobile phone connected to a standard GSM network?
If it is, then the short version of the story is "Forget it" even if the IP wasn't dynamic, you simply wouldn't be talking to the IP of your device, you'd actually be talking to the IP address of your providers GGSN, and for a standard consumer connection this is going to be where the buck stops.
Now that said, IF you have the budget, and all your devices (Assuming multiple ones) are with the same carrier, then you can approach the carrier and request a dedicated APN (Access point name) essentially what this is , is the mobile network equivalent of a DNS record, or at least similar enough to use that analogy anyway.
When you set up your data connection on your device you may recall having to enter something like 'pp.vodafone.com' or 'INGhub411.o2-uk.inbound' we'll this is your actual APN, and if you have a custom one they your devices can be set up so that the IP the presents itself at the GGSN actually has a static route back to the individual device in the suppliers GSM network.
As a general rule of thumb however on consumer grade connections this is not enabled and hence there is no ingress available to the individual device.
As zmbq says, the ONLY option you have is for the device to keep polling the server on a regular basis, and yes unfortunately that is going to be very unforgiving on the battery.
of course there is one other way of approaching this, and that's to have the device open a socket directly to your server then keep that socket open. Once the socket is open, 2 way communication can be performed across the link, unfortunately your going to also have to write all the code to manage this connection including, but not limited to monitoring the connection to make sure it's still open and re-establishing it if it's not, something which is incredibly important on a mobile device.
I am writing a C# Winforms program to get all the computers that are connected to my LAN, based on the given IP address range.
I am using the Ping class to identify the computers.
But the problem here is I am getting responses from all the devices like (printer, IP phone, etc) that are connected to LAN.
Please help me in filtering these devices and to get only computers from LAN.
It's impossible to tell using PING whether a network node is a computer/printer/ip phone etc.
You would need to use a higher level protocol like NETBIOS or DNS to work this out but it depends very much on how the devices are implemented.
Well, chances are that the printer, phone, etc. have general purpose computers in them running a TCP/IP stack and some specialized server software, so it boils down to what your definition of what a "computer" is... still, it sounds like more trouble than it's worth, unless you can identify something that only what you think of as computers will have, and that all of them will have. On a Windows network, SMB, perhaps - but that could catch a NAS that exposes storage over SMB.
I don't think there's a general way to do what you want to do. Like Lloyd pointed out, nmap does some fingerprinting, but that is far from perfect (it will usually get pretty close to a specific OS version, but it can't tell what kind of physical device is running that OS).
I have an embedded system running a web server that will usually be connected to an Ethernet network so users can simply enter the IP address of the device to access it.
However, I also need to make some of the same website functionality avaiable to users of the serial port on the device. It would be nice if I could reuse some of the logic I've developed for the web forms for this.
I am currently using .NET for development on my desktop and my embedded device is Linux based. Is it possible to host website content via a serial port or is there some other means by which I can pull this off?
Just a wild guess: back in the days when you connected by modem to the internet, there was a SLIP protocol: IP over Serial Line. Could you use that to establish an "internet connection" to your device?
There are a few options:
If the server is to be in windows, and you have windows 7 then windows xp mode (1) (2) will allow you to use SLIP so that you can provision over serial as you would to any IP address by mapping the serial port to an IP address.
Alternatively there is a sourceforge project called Contiki which has source code to allow the same if you fancy coding your own (the class is called uIp TCP/IP Stack).
Let me know if this is roughly what you're looking for and I can focus in on your specific requirements if you like:)
Cheers.
The first thing that comes to mind is some sort of LYNX like browser (I don't even know if it exists anymore). Maybe easier would be to just do a simple command line interface? It's linux, so you should just be able to spin up a telnet session pretty easily, right?
I believe you should be able to configure your Linux distribution to point your serial port at a terminal, and have that terminal log in with lynx as the shell.
You might want to follow directions for a Linux serial console (tutorial here) and potentially create a user account with the shell set directly to run lynx. Instruct the login prompt (/etc/issue in the tutorial) with the username and password.
Edit: If you're just looking for some sort of data entry from the console, you could just write a shell script or other program and point that user's shell to that application instead.
You could build a TCP client application on your linux device that will talk to your linux web server and redirect data to serial port, and build a TCP server application for your users that will talk to their serial port and redirect data to some TCP port (like 12345). Then all your users need to do is to set their browser to http://localhost:12345 and connect their PC to linux device via serial port cross over cable.
I am looking for something to test my app. The app is a weight logger, built in .net 3.5 - it is connected by rs232 to an electronic weight, but the problem is that I don't have it at home.
I wanted to emulate the traffic and data with my app, but I have a problem: I can't get 2 apps on 1 port.
Please help.
These are the tools you need:
com0com: Creates two virtual COM Ports which are connected to each other
Just connect your receiver application with the first one and your mock weight application with the second one.
Serial Port Monitor: If you need to sniff into some serial port connection to find out how another application communicates with some serial device.
Update
The storing and filtering is just to specific to your concrete project, so that you wouldn't find anything "out of the box". But you have two possibilities to store the data.
Within your application implement some kind of wrapper class for your serial port. Every read and write access to the serial connection goes through this class. Then this class sees everything and can dump the whole traffic into a file or somewhere else. Additionally you could also implement some kind of filter mechanism.
Instead of putting the dump and filter logic into your program, write it as an application. This application connects to two COM ports. The first is the real serial port. The other is a virtual from the com0com driver. Your application that normally communicates with your serial device will now be connected to the second com0com driver. So you're able to dump and filter anything that flows through your serial port.
I have a C# application running on a server, and it needs to copy files out to multiple Windows Mobile 5.0 devices. These devices are connected to the network directly via Ethernet-enabled cradles (so they are not connected to a PC via ActiveSync).
What different options do I have for doing this? I know RAPI can do this, but I'm not sure if it can copy something directly over the network like this. Also, I know RAPI uses ActiveSync DLLs and thus requires ActiveSync to be installed, and we would prefer to avoid doing this if possible.
Is WMI a possibility? Can we use ordinary File.IO if we can somehow get the IP address of each device? Code samples or general knowledge would be most welcome.
Normal file I/O isn't going to work. The devices don't have file sharing OS components, so you can't "browse" to them over the network like you might a PC.
RAPI does use ActiveSync, so not only do you have to have AS installed, the devices must also be actively connected, and ActiveSync only allows one device connection at a time, so it's not going to work for what you want.
My solution for this type of scenario has always been the same. You have to install some sort of "listener" on the devices, whether it is your deployedd app or some form of installer. Sometimes I use an autorun app on an inserted CF/SD card (all depends on your topology).
I usually have that app listen for a UDP broadcast of a "discover" packet from the PC. When they receive it, they in turn UDP broadcast out their IP address and the PC collects those. The PC then sends the files via a TCP socket to the device(s) through the listenner app.
Lately I've been doing all of the device-side pieces via a REST service hosted in Padarn to minimize the amount of comms code on the device I have to write, but you could do it all with Udp/TcpClients without too much difficulty.