Sending Serial Commands Via Ethernet

Posted on
Sending Serial Commands Via Ethernet 3,7/5 8627 votes

Morph 1.8. Eqooo wrote:Hi everyone, I want to use ethernet communication on my desktop with my pi. I want to learn how to do 'ethernet to ethernet communication'. How can I send a data from pc to RPi? I'm using Debian for RPi. Lots of ways to approach this. One is to sens small packets of information using UDP sockets.

However, since there is an Ethernet port and i can send the serial command to that similar device using Netcat, how can i let this script to send commands through the ethernet port instead of the serial port? What should i change? Sorry but i'm really clueless on how to do this. I've searched through google and i can't find answers.

How To Send Serial Commands

UDP is good for small messages and fast delivery, but bad for large transfers and reliable delivery on busy networks. UDP is more like a serial port connection than STREAM sockets, which are more reliable, are better for large transfers. This link shows some of the basics in Python, but you could use almost any language: There are lots of programming libraries that have features to support network communication. UDP and STREAM socket programming is low level.

For tasks more complicated than simple messages you will probably be better of using a library. Pygame easy networking: You can use netcat to pipe data from one program, over the network and into another program. Eqooo wrote:Thanks so much your answers.

If I connect to internet, I need to socket programming with TCP/IP or UDP or others. But I want to say there is no internet.

Sending Serial Commands Via Ethernet

So I want to connect Pc to RPi direct connection wit Ethernet cable. How can I do?

Connect your Pi and PC via an ethernet cable. Find your PC's IP address (something like 192.168.x.y).

Go to your raspberry Pi and enter the command sudo ifconfig eth0 192.168.x.z where z is a number 1 greater than y. You should then be able to ping between the machines and use ftp etc. From a programming language you should be able to open a socket on the Pi from your PC (and vice versa).

Eqooo wrote: if I connect to internet, I need to socket programming with TCP/IP or UDP or others. But I want to say there is no internet. So I want to connect Pc to RPi direct connection wit Ethernet cable.

How can I do? TCP/IP is the protocol to use over internet, it doesnt mean that you NEED the internet to use TCP/IP. You can send raw ethernet packets to the Pi if you know the MAC address. Example: But its more work, so its basicly safer and easier to use TCP/IP and you have so many libraries and guides on the net to help you in any language.

Display posts from previous: Sort.