netcat

Non-responsive stream delegate in Swift

会有一股神秘感。 提交于 2019-12-21 04:30:20
问题 So I was playing around with sockets in Swift and trying to connect the app with my server. I was having the app connect to the IP address of the server and used netcat on the server for testing. During execution, the console output from the app showed it had successfully connected to the server. However, the stream delegate does not seem to be responsive. When I typed into netcat , the app console did not print anything. I have searched for quite a while and found that my implementation is

nc (netcat) on Mac OS X 10.8.4 gets stuck

梦想的初衷 提交于 2019-12-19 04:09:33
问题 I encountered a little issue while using the nc utility on Mac OS X, a utility i often use as a quick and dirty solution to check if a port is open and what version the daemon is running. We deployed a new set of computers the other day and i wanted to verify what version of sshd they were running, without having to leave my chair. This is the command i ran and the resulting output: $ for i in {183..200}; do echo "hello" | nc -n -w 2 -v 10.120.113.$i 22; done Connection to 10.120.113.183 22

Create a minimum REST Web Server with netcat nc

落花浮王杯 提交于 2019-12-18 11:37:33
问题 I was looking for the minimum REST web server using nc to be a one-liner for a Docker container. For instance: * http://localhost/echo/marcello: prints marcello * http://localhost/date: prints the server's date * http://localhost/...: others I was looking at the question "Minimal web server using netcat", but it proxies the calls to shell scripts... I just need one liners like the ones while true ; do nc -l -p 1500 -c 'echo -e "HTTP/1.1 200 OK\n\n $(date)"'; done The other solution posted is

Send POST request with netcat

。_饼干妹妹 提交于 2019-12-18 10:49:14
问题 I have found this little script in PHP that send a simple request to twitter for update your status, I have tried this: http://pratham.name/twitter-php-script-without-curl.html, and it work. Now, I want send this request with netcat, but this doesn't work, why? I send request in this way: echo -e $head | nc twitter.com 80 The $head are my header that I have tried with also PHP, so it are right. Anyone know how I can make this? Thanks to all. edit. head="POST http://twitter.com/statuses/update

How to make an HTTP GET request manually with netcat?

匆匆过客 提交于 2019-12-17 17:38:14
问题 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. 回答1:

netcat中获取主机信息的方法(3-1)

有些话、适合烂在心里 提交于 2019-12-14 19:55:45
在netcat 中,通过gethostpoop()函数获取主机信息。 1初始化套接字 在获取主机信息之前必须初始化套接字。在netcat中,通过res_init()函数实现套接字的初始化。在res_init()函数中,调用WSAStartup()函数初始化套接字。 WORD wVersionRequested; WSADATA wsaData; int err; wVersionRequested = MAKEWORD(1, 1); err = WSAStartup(wVersionRequested, &wsaData); if (err != 0) return; 以上代码初始化了1.1版本的套接字。接下来再次验证是否初始化的是1.1版本的套接字。 if (LOBYTE(wsaData.wVersion) != 1 || HIBYTE(wsaData.wVersion) != 1) { WSACleanup(); return; } 在main()函数中,调用res_init()函数。 2 获取主机信息 2.1 函数定义 gethostpoop()函数的格式为 HINF* gethostpoop(char* name, USHORT numeric); 其中,参数name表示输入的IP地址或者主机名,numeric指定了name的含义,当numeric为0时

netcat中获取主机信息的方法(3-2)

孤者浪人 提交于 2019-12-14 12:55:41
2.3 当参数name是主机名时的处理 当net_addr()函数返回INADDR_NONE,则需要考虑参数name是主机名。即 if (iaddr.s_addr == INADDR_NONE)//name是计算机名 { if (numeric) { bail("Can't parse %s as an IP address", name); } ....... } 2.3.1 numeric值的判断 在“ 2.1 函数定义 ”中提到, gethostpoop()函数的参数numeric的值是与参数name对应的,当numeric的值是0时,则name的值必须是主机名;当numeric的值是非0时,则name的值必须是IP地址。所以,当 参数name是主机名时,必须要判断 numeric的值是否是0,如果不是0,则弹出错误信息。 2.3.2 根据主机名获取主机信息 hostent = gethostbyname(name); if (!hostent) { char my_h_errno[10] = { 0 }; _itoa(h_errno, my_h_errno, 10); bail("%s: forward host lookup failed: h_errno %s ", name, my_h_errno); } else { ....... } 其中

Is there a netcat alternative on Linux using Python? [closed]

≯℡__Kan透↙ 提交于 2019-12-14 03:26:54
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 2 years ago . netcat is not available in our Linux prod environment for security reasons. I'm trying to write/read short text messages into a port for logging. Write to port on worker nodes read on logger node. netcat would do the job Is there a way to do the same on Linux using Python? 回答1: i made you a script, save this,

Huge difference in netcat and iperf results for a 10G link

北城以北 提交于 2019-12-14 01:33:23
问题 I am confused to see huge difference between netcat and iperf results. I am having 10 G link connecting my server and client. I am getting around 10Gb/s for iperf but only ~280 MB/s for netcat. What can be the error ? For Iperf Server iperf -s Client iperf -c 172.79.56.27 -i1 -t 10 Result: Client connecting to 172.79.56.27, TCP port 5001 TCP window size: 85.0 KByte (default) ------------------------------------------------------------ [ 3] local 172.79.56.28 port 46058 connected with 172.79

POST receiver (server)

落花浮王杯 提交于 2019-12-13 04:37:07
问题 I find myself in need of a way to test the post requests made from my application. I'm sending my request to http://macbook-pro.local/ , and I'm trying to figure out what service I can run to read and display the request. I looked into RestKit without any luck. Using SignalR could work, but the port to macos isn't working as expected. 回答1: What you want is basically a very simple web server, but if all you want is printing out what comes in a HTTP POST request you can get away with using the