tcp

Powershell AcceptTcpClient() cannot be interrupted by Ctrl-C

£可爱£侵袭症+ 提交于 2020-07-05 12:55:48
问题 I am writing a simple TCP/IP server using Powershell. I notice that Ctrl-C cannot interrupt the AcceptTcpClient() call. Ctrl-C works fine after the call though. I have searched around, nobody reported similar problem so far. The problem can be repeated by the following simple code. I am using Windows 10, latest patch, with the native Powershell terminal, not Powershell ISE. $listener=new-object System.Net.Sockets.TcpListener([system.net.ipaddress]::any, 4444) $listener.start() write-host

Powershell AcceptTcpClient() cannot be interrupted by Ctrl-C

时光怂恿深爱的人放手 提交于 2020-07-05 12:55:27
问题 I am writing a simple TCP/IP server using Powershell. I notice that Ctrl-C cannot interrupt the AcceptTcpClient() call. Ctrl-C works fine after the call though. I have searched around, nobody reported similar problem so far. The problem can be repeated by the following simple code. I am using Windows 10, latest patch, with the native Powershell terminal, not Powershell ISE. $listener=new-object System.Net.Sockets.TcpListener([system.net.ipaddress]::any, 4444) $listener.start() write-host

Invalid argument“ setting key ”net.core.somaxconn"

烈酒焚心 提交于 2020-07-04 09:10:47
问题 I tried setting Linux kernel. After editing /etc/sysctl.conf and executing the sysctl -p it shows error Invalid argument" setting key "net.core.somaxconn" Linux distribution: Ubuntu 12.04.4 LTS, x86_64, 3.2.0-60-generic $ cat /etc/sysctl.conf net.ipv4.conf.eth0.arp_notify = 1 vm.swappiness = 0 net.ipv4.tcp_rmem = 4096 87380 4194304 net.ipv4.tcp_wmem = 4096 16384 4194304 net.core.wmem_default = 8388608 net.core.rmem_default = 8388608 net.core.rmem_max = 16777216 net.core.wmem_max = 16777216

Invalid argument“ setting key ”net.core.somaxconn"

左心房为你撑大大i 提交于 2020-07-04 09:07:16
问题 I tried setting Linux kernel. After editing /etc/sysctl.conf and executing the sysctl -p it shows error Invalid argument" setting key "net.core.somaxconn" Linux distribution: Ubuntu 12.04.4 LTS, x86_64, 3.2.0-60-generic $ cat /etc/sysctl.conf net.ipv4.conf.eth0.arp_notify = 1 vm.swappiness = 0 net.ipv4.tcp_rmem = 4096 87380 4194304 net.ipv4.tcp_wmem = 4096 16384 4194304 net.core.wmem_default = 8388608 net.core.rmem_default = 8388608 net.core.rmem_max = 16777216 net.core.wmem_max = 16777216

TCP client for Android: text is not received in full

[亡魂溺海] 提交于 2020-06-29 03:57:06
问题 I am converting a Java desktop project to Android. Part of it includes a TCP connection to a server and parsing a long text from the server to the client (the Android application). This is the code that I have for the desktop project that I also try to use in Android: // Method is called when a button is tapped public void tapButton() { // Create a message to the server that requests for the Departure navdata String messageToServer = someMethodToMakeHandshakeMessage(); // Connect to the

Choppy Audio with Naudio and TCP Stream. Buffer Full Exception

荒凉一梦 提交于 2020-06-29 02:56:33
问题 I am attempting to stream audio using Naudio over a TCP connection. The problem is the audio sounds choppy. I believe this is because I am getting an exception saying the buffer is full when I try to add samples to the bufferedwaveprovider. I have tried increasing the buffer size however the result remains unchanged. -----CLIENT CODE----- public TcpClient client; public WaveOut waveplayer = new WaveOut(); public BufferedWaveProvider bwp = new BufferedWaveProvider(new WaveFormat(8000, 16, 1));

avoid having to do adb tcpip 5555 every time

梦想的初衷 提交于 2020-06-28 06:48:05
问题 I like being able to work with my android phone using ADB over WIFI. After connecting it via USB, I run adb tcpip 5555 , and then I can disconnect the USB and run adb connect {phone's IP}:5555 . What I don't like is that every time I have to restart my phone, I have to reconnect the USB and rerun adb tcpip 5555 command. Is there any way to make it remember the 5555 setting so it's always in "TCP mode port 5555"? Thanks EDIT: my phone is Android 9 limited. Is not rooted. Tried ADB over WIFI

how to close a websocket like if chrome window was closing to flush the buffer to 0

只愿长相守 提交于 2020-06-28 05:01:23
问题 when with portfowarding the websocket pass by internet and only send when the connexion is close (on my network it's like that), I first try to close the websocket by closing chrome(it worked), so now i found terminate that i think can do the same than closing the webbrowser,but it's only for the serveur that have this function and the problem is that the buffer with close is not 0 but 13... so how can i do a hard close with ws.terminate or something else to flush the buffer to 0 and a basic

How to download a file from http using C?

可紊 提交于 2020-06-25 06:29:29
问题 I spent the last days trying to figure out how to download a file from an URL. This is my first challenge with socket and I'm using it to have an understanding of protocols so I would like to do it without cURL libraries and only in C language!! I searched a lot....now I'm able to printf the source code of a page but I think it's different with a file, I don't have only to put the received data from a buffer to a file, right? any tips? #include <sys/socket.h> #include <sys/types.h> #include

Connection reset by Peer pymongo

浪子不回头ぞ 提交于 2020-06-24 12:15:47
问题 I have some documents which I have to fetch from mongodb and set it to memcache. Here is the code import memcache from pymongo import MongoClient db = mongo_client.job_db.JobParsedData jobs = db.find().sort("JobId", 1) def set_to_memcache_raw(jobs): print("Setting raw message to memcache") count = 0 for item in jobs: job_id = item.get('JobId') job_details = item.get('JobDetails') if job_id.strip(): count += 1 memcache_obj.set(job_id, job_details, time=72000) if count % 1000 == 0: print(