1

I am working on project which involves sending datastream from Raspberry Pi to Windows PC. This should only be done through Ethernet link. I looked for ethernet libraries but I did not find any. Also I don't know which type of cable (straight or crossover) is to be used but I have a straight one.

Which protocol to use? Which type of (straight/crossover) Ethernet cable? Do you use any specific tool on windows PC to see incoming datastream or is it command prompt of windows?

5
  • you need to read this link before using library.
    – Ephemeral
    Commented Jun 17, 2019 at 10:13
  • see also L2TP and IPSEC (very good network and security knowledge needed.).
    – Ephemeral
    Commented Jun 17, 2019 at 10:26
  • 1
    For what do you need a library? I just use IP over ethernet connections with given protocols also known by MS Windows.
    – Ingo
    Commented Jun 17, 2019 at 10:55
  • @Ingo can elaborate more on how you establish connection? which protocol you use? which type of (Straight/Cross) Ethernet cable? Do you use any specific tool on windows PC to see incoming datastream or is it command prompt of windows? Commented Jun 17, 2019 at 12:20
  • @Ephemeral thanks for the links i am reading them currently. Commented Jun 17, 2019 at 12:22

3 Answers 3

2

First there is no need to worry about the used ethernet cable. It doesn't matter if you use a straight forward or a cross over cable. Nearly all devices since years are able to detect this including Raspberry Pi.

Because it is unclear what you want to do, I can only give some general ideas. What does it mean "sending a datastream"? Do you want to send data into a file? Then you can open a network share on the MS Windows computer and put the data into a file on the network share. Or you can do it the other way around: open a network share on the RasPi and access the file from the MS Windows computer. To use MS network shares you have to install samba on the RasPi.

You can stream data using linux networking tools for example ssh together with dd. For continuous streaming netcat is a good choice.

If you have specific requirements you can program it with python using network sockets. You should find examples on the web how to do it.

How to handle all of this on the MS Windows side is out of scope here. It's not an issue to Raspberry Pi.

1
  • @lngo I have tried simple python scripts (RPi to linux) which did not work thus ms windows looks like a mountain to climb.I want to send continuous stream of sensor readings over ethernet from RPi to ms windows, which should be visible at windows in run time. I searched for such a tool/software for windows but looks like command like is the only option.Currently looking into SSH dd and netcat. Commented Jun 18, 2019 at 11:44
1

Solution 1

Here is an easy solution that I only found after years using various RPi devices! (more about it on this blog). The cool thing is that it works:

  • without having to change anything in the Windows LAN configuration (*)

  • without having to install a DHCP server on Windows (dhcpsrv.exe is a useful tool, but here we can do without it)

  • without having to guess the IP address or use nmap tools to find the IP

  • without a router, you can use this with a direct Ethernet connection PC <-> RPi

It works thanks to "APIPA" "Automatic Private Internet Protocol Addressing" which works automatically in the IP range 169.254.xxx.xxx.

In short:

  • open /boot/cmdline.txt on the micro SD card, add ip=169.254.0.55 at the end

  • plug the RPi to the Windows PC with an Ethernet cable

  • use the "Putty" software and connect with SSH to 169.254.0.55, that's all!

Note: (*) modifying Windows LAN parameters is not needed with this solution, you don't need to do anything here:

enter image description here

NB:

  • it seems that, with this method, the RPi cannot use the ethernet connection of the PC to go on the internet (no gateway).

  • if no ethernet cable is connected, there is an annoying waiting time:

    Waiting up to 110 more seconds for network
    Waiting up to 100 more seconds for network
    ...


Solution 2

Another solution is to:

  • not add ip=... in /boot/cmdline.txt
  • not modify /etc/network/interfaces
  • just install Bonjour software on Windows: https://support.apple.com/kb/DL999?locale=en_SG if not already installed. This will enable ZeroConf/Avahi/Bonjour features. Then ping raspberrypi.local works!
0

I actually did a project very similar to what you are trying to do. I did a bear nanny cam that took a jpg every 5 seconds and A/V every so often. I did a bash alias, for the action with i scheduled with cron.

Listen = alias listen='sox -t alsa plughw:1 $DATE.wav'

You would need to send it to a file on your PC that was shared. WinSCP is money.

Good luck!!!

2
  • That doesn't address the question.
    – RalfFriedl
    Commented Jun 29, 2019 at 9:28
  • That's a direct hit on the question. He would need to write the command hr wants. Give it an alias. Add the alias to bashrc. schedule it with cron. My name should be on the project lol, jk Commented Jun 29, 2019 at 14:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.