Any experience with a SMC JXC91? - c#

I have a JXC91 paired with an actuator LER50-K in this case. I communicate with it via ethernet ip protocol C# ethernet ip library. The only thing I want is to get the actuator name. The manual and eds file do not mention any commands for this service what I could see and the Identity Object only gives me information about the JXC model.
I have the JXC91 connected to my PC via ethernet/usb adapter and the manufacturers program (ACTC Controller) is able to find it.
Any ideas?
Thanks

Related

Communicate between computers through Ethernet cable

I want to connect two computers with an Ethernet cable without the user having to set up a LAN through the Control Panel and then transfer data between two instances of my app - one running on each computer.
As soon as I have a connection with an IP address for each computer, I know I can easily transfer a file by using Sockets, Pipes(?), WCF... But both computers are also connected via wifi to a router, so how can I somehow tell the computer that for a specific IP address - please use the cable? (I might be getting all of this wrong. Please feel free to correct me.)
I can use a UWP app or a .net (Winform/WPF) app. Either technology is fine. But this must be done in code, not by the users setting up a LAN through the Control Panel. Also, IPv6 is fine too.
Each network card has its own IP address, so both of the computers will have IP address for the WIFI network and another IP address for the ad-hoc link.
The addresses for the ad-hoc link can be set to an address in one IP segment, for example, 10.0.0.1 and 10.0.0.2, if the WIFI addresses are in the range of 192.168.X.X.
Your OS will know which card is related to each IP segment.
Start with System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces().
Filter out the Type=EtherNet interfaces and make sure they're Up. You may also have to watch out for virtual adapters etc.
From the selected adapter you can get Address Information etc. The IPV4 address should probably be enough to get you started.

Communicate between computers through USB cable

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

How to select ethernet or wifi to send TCP?

Here is my problem: My computer is connected to internet with ethernet cable, and also connected to a wifi module. But when I want to send TCP to my module, it always choose ethernet by default.
I have to disconnect my cable to send TCP to my module, but I will need the two connections and know how to swap between them.
How can I choose the interface i want in c#?
Can I swap between them in a single program?
I already use System.Net and the Managed Wifi API.
Thank you for your answers.
Edit:
As #Someprogrammerdude and #sam suggest, i use socket.bind() with the IP address of the default gateway of my wifi to send TCP on it. But when I try to bind, there the requested address is not valid in this context error. So I checked the default gateway address (sry french) :
ipconfig
We can see that my wifi default gateway is 192.168.1.2 and ethernet 192.168.1.1. I tried to put them "manually" but i have the same result.. It cannot be the port i checked myself on the module that he is well opened
Edit 2:
Nvm, i had to bind 192.168.1.100, and not 192.168.1.2. Thank you for your answers, you helped me a lot.
Which interface is used is decided by the local routing table. A cable interface (often) is faster, so it'll get a lower network metric and is subsequently preferred. With DHCP clients, this may also be configured from the DHCP server (if it allows manual settings).
Depending on your system, you can manipulate the interfaces' network metrics (likely need to deactivate DHCP for that) and if you'd like to prefer wireless, just reduce its metric below that of the Ethernet interface. Alternatively, you can add routes to certain services you want to be transferred via wireless to the wireless interface with a lower metric.

C# TcpListener external IP

I'm creating a TcpListener, and I want clients from other computers to be able to join my listener.
I've read and understood that I have to do Port Forwarding, but it doesn't make any sense to me - when I publish my app, I want other people to create this Listener, and I can't tell them to do Port Forwarding.
Is there any possibility to create a TcpListener that clients will be able to join without Port Forwarding?
Thank you.
Well, lets try to clear somethings out first.
The main reason to use port forwarding is because you have a NAT router in front of an internal network. To setup a port forward is to instruct the NAT router to forward traffic to a certain port on the public interface to a port on an internal computer.
If you don't have a NAT router you don't need port forwarding.
Many routers today support UPnP, a technique to kindly ask the router to create a specific port forward. A suitable library to use might be ManagedUPnP.
However you still need to figure out the public IP of the router and what port you have opened and communicate that to your other applications.
If your router does not allow UPnP or there are other fire wall rules in place you can not set up a port forwarding correctly.
You can create server application and forward ports on your pc. Client application (this one you will publish) will just connect to your pc so they can be on the NAT. You can also combine your application with some php/asp pages but it depends on data you would like to send. If it's some kind of PC statistics like uptime, hardware etc. you would just use http query in client app to website script you've created (for instance mypage.com/?uptime=100&ram=2gb&hash=xxxx etc.)
Only the server (the computer which is accepting TCP requests) needs to have the port forwarded.
The common model is that you (the developer/producer of the service) host the server. Then customers (people who subscribe to your service) connect to your service using either an IP or a URL. If your service is behind a firewall (you have a router between your computer and your internet modem) then you will have to forward the port. You will probably also have to open the port in Window's firewall, but I expect you have done this already. In this model the customer does not have to do anything with their router (it is like using a web browser).
If you are making a product where your customers are hosting the service then they will have to deal with the port issues. In which case you could try ManagedUPnP like Albin Sunnanbo suggests or redirect them to one of the many sites explaining how to setup port forwarding.

View Website Through Serial Port

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.

Categories