netcat

Stream video from Raspberry pi to Opencv application on remote computer

谁说我不能喝 提交于 2019-11-28 11:45:11
What I am trying to achieve is, I have a raspberry 3 with pi camera v2 connected to my local wifi. I want to transmit a live video from the raspberry pi to a computer running Ubuntu. On my computer I am trying to process that video with opencv in real time. The code below is just a sample code to test the video coming from the raspberry pi on my Ubuntu computer. I am using netcat to stream the video and I have listed the shell script below the code. #include <opencv2/highgui/highgui.hpp> #include <opencv2/imgproc/imgproc.hpp> #include <iostream> using namespace std; using namespace cv; int

Using netcat/cat in a background shell script (How to avoid Stopped (tty input)? )

空扰寡人 提交于 2019-11-28 10:13:36
Abstract: How to run an interactive task in background? Details: I am trying to run this simple script under ash shell (Busybox) as a background task. myscript.sh& However the script stops immediately... [1]+ Stopped (tty input) myscript.sh The myscript.sh contents... (only the relvant part, other then that I trap SIGINT, SIGHUP etc) #!/bin/sh catpid=0 START_COPY() { cat /dev/charfile > /path/outfile & catpid = $! } STOP_COPY() { kill catpid } netcat SOME_IP PORT | while read EVENT do case $EVENT in start) START_COPY;; stop) STOP_COPY;; esac done From simple command line tests I found that bot

Scripting an HTTP header request with netcat

故事扮演 提交于 2019-11-28 05:58:00
I'm trying to play around with netcat to learn more about how HTTP works. I'd like to script some of it in bash or Perl, but I've hit upon a stumbling block early on in my testing. If I run netcat straight from the prompt and type in a HEAD request, it works and I receive the headers for the web server I'm probing. This works: [romandas@localhost ~]$ nc 10.1.1.2 80 HEAD / HTTP/1.0 HTTP/1.1 200 OK MIME-Version: 1.0 Server: Edited out Content-length: 0 Cache-Control: public Expires: Sat, 01 Jan 2050 18:00:00 GMT [romandas@localhost ~]$ But when I put the same information into a text file and

How to make an HTTP GET request manually with netcat?

*爱你&永不变心* 提交于 2019-11-28 04:57:10
So, I have to retrieve temperature from any one of the cities from http://www.rssweather.com/dir/Asia/India . Let's assume I want to retrieve of Kanpur's. How to make an HTTP GET request with Netcat? I'm doing something like this. nc -v rssweather.com 80 GET http://www.rssweather.com/wx/in/kanpur/wx.php HTTP/1.1 I don't know exactly if I'm even in the right direction or not. I am not able to find any good tutorials on how to make an HTTP get request with netcat, so I'm posting it on here. Of course you could dig in standards searched for google, but actually if you want to get only a single

Executing script on receiving incoming connection with xinetd

随声附和 提交于 2019-11-28 01:52:57
问题 I want xinetd to execute a shell script when a connection is received on a certain port. To accomplish this, followed this tutorial: [enter link description here][1] Unfortunately, the whole thing doesn't work as I hoped that's why I am going to show you my configuration. The script that is called by xinetd is located at /usr/local/bin. It can be executed without any problems: #!/bin/bash echo "connection received" /etc/xinetd.d/testservice has this content: service testservice { disable = no

Minimal web server using netcat

旧巷老猫 提交于 2019-11-27 16:45:56
I'm trying to set up a minimal web server using netcat (nc). When the browser calls up localhost:1500, for instance, it should show the result of a function ( date in the example below, but eventually it'll be a python or c program that yields some data). My little netcat web server needs to be a while true loop in bash, possibly as simple as this: while true ; do echo -e "HTTP/1.1 200 OK\n\n $(date)" | nc -l -p 1500 ; done When I try this the browser shows the currently available data during the moment when nc starts. I want the browser displays the data during the moment the browser requests

Netcat implementation in Python

眉间皱痕 提交于 2019-11-27 12:41:06
I found this and am using it as my base, but it wasn't working right out of the box. My goal is also to treat it as a package instead of a command line utility, so my code changes will reflect that. class Netcat: def __init__(self, hostname, port): self.hostname = hostname self.port = port def send(self, content): self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.socket.connect((self.hostname, self.port)) self.socket.setblocking(0) result = ''; read_ready, write_ready, in_error = select.select([self.socket], [], [self.socket], 5) if(self.socket.sendall(content) != None):

Redis进阶实践之十六 Redis大批量增加数据

一世执手 提交于 2019-11-27 12:00:42
Redis进阶实践之十六 Redis大批量增加数据 一、介绍 有时候,Redis实例需要在很短的时间内加载大量先前存在或用户生成的数据,以便尽可能快地创建数百万个键。这就是所谓的批量插入,本文档的目标是提供有关如何以尽可能快的速度向Redis提供数据的信息。如果想查看英文原文,地址如下: https://redis.io/topics/mass-insert 二、操作详解 话不多说,直接进入主题了。 1、使用协议,卢克(Use the protocol, Luke) 使用普通Redis客户端的方式执行批量插入的操作并不是一个很好的办法,原因如下:发送一个命令的方式很慢,因为您必须为每个命令都会有往返的时间消耗。虽然可以使用管道模式来操作,但为了批量插入多条记录,您需要在读取回复的同时编写新命令,以确保尽可能快地插入。 另外,只有一小部分客户端支持非阻塞 I/O 操作,而且并不是所有的客户端都能够以最大化吞吐量这种有效的方式来解析这些回复。 由于以上这些原因,将大量数据导入Redis的首选方式是生成包含Redis协议的文本文件(原始格式),以便调用插入所需数据所需的命令。 例如,如果我需要生成一个大型数据集,其中包含数十亿个键:“keyN - > ValueN”,我将创建一个包含如下Redis协议格式的命令的文件: SET Key0 Value0 SET Key1 Value1 ..

Strange behaviour of netcat with UDP

六月ゝ 毕业季﹏ 提交于 2019-11-27 11:08:19
问题 I noticed a strange behaviour working with netcat and UDP. I start an instance (instance 1) of netcat that listens on a UDP port: nc -lu -p 10000 So i launch another instance of netcat (instance 2) and try to send datagrams to my process: nc -u 127.0.0.1 10000 I see the datagrams. But if i close instance 2 and relaunch again netcat (instance 3): nc -u 127.0.0.1 10000 i can't see datagrams on instance 1's terminal. Obsiously the operating system assigns a different UDP source port at the

How to make an Echo server with Bash?

混江龙づ霸主 提交于 2019-11-27 09:59:05
问题 How to write a echo server bash script using tools like nc, echo, xargs, etc capable of simultaneously processing requests from multiple clients each with durable connection? The best that I've came up so far is nc -l -p 2000 -c 'xargs -n1 echo' but it only allows a single connection. 回答1: If you use ncat instead of nc your command line works fine with multiple connections but (as you pointed out) without -p. ncat -l 2000 -k -c 'xargs -n1 echo' ncat is available at http://nmap.org/ncat/. P.S.