sockets

How to send a message to a Firefox extension using a C# Application?

耗尽温柔 提交于 2021-02-07 09:38:07
问题 I have created a Firefox extension and a C# application and I need to send a String to my extension to perform some work I need to send it through an HTTP request like sockets. I have read about nsIServerSocket and having trouble connecting to my C# application Firefox (extension) code: function startServer() { var listener = { onSocketAccepted : function(socket, transport) { input = clientSocket.openInputStream(0, 0, 0); }, onStopListening : function(socket, status){} }; var serverSocket =

In Golang, how to receive multicast packets with socket bound to specific address/port?

时光总嘲笑我的痴心妄想 提交于 2021-02-07 09:07:07
问题 Task at hand is to bind a socket specifically to address 1.0.0.2:520 (assigned to eth2), then read multicast UDP packets addressed to 224.0.0.9:520. I am trying the code below, based on https://godoc.org/golang.org/x/net/ipv4 Unfortunately, result is this debbuging message is never reached: log.Printf("udpReader: recv %d bytes from %s to %s on %s", n, cm.Src, cm.Dst, ifname) I know eth2 is receiving the desired packets because I have this packet sniffer running on it: sudo tcpdump -n -i eth2

In Golang, how to receive multicast packets with socket bound to specific address/port?

只谈情不闲聊 提交于 2021-02-07 09:06:56
问题 Task at hand is to bind a socket specifically to address 1.0.0.2:520 (assigned to eth2), then read multicast UDP packets addressed to 224.0.0.9:520. I am trying the code below, based on https://godoc.org/golang.org/x/net/ipv4 Unfortunately, result is this debbuging message is never reached: log.Printf("udpReader: recv %d bytes from %s to %s on %s", n, cm.Src, cm.Dst, ifname) I know eth2 is receiving the desired packets because I have this packet sniffer running on it: sudo tcpdump -n -i eth2

listen called on socket more than once — expected behavior?

◇◆丶佛笑我妖孽 提交于 2021-02-07 09:02:28
问题 I noticed something odd while working with a simple C-based server program on my Linux (4.10.3) system. I accidentally ended up calling listen() twice on a socket (from the server process) I had called bind() on earlier. I noticed that both the listen calls succeeded without any errors. In fact, it doesn't seem to matter how many calls to listen I make, all calls to listen succeed. I was expecting all the calls to listen after the first one to fail with EADDRINUSE . Am I missing something?

multiport listening socket linux

一曲冷凌霜 提交于 2021-02-07 08:57:16
问题 I am writing a multithreaded server application, in C (linux), that must listen to 2 different port numbers, say listen to port no 3000 and 4000, for different clients connecting to it to serve different functionality (actual function is executed by a worker thread, main thread runs indefinitely and spawns of new workers upon new connections). I am not sure if select would work here as we can have multiple socket connections but all associated with same port number. I tried sequentially

Why does HttpWebRequest not sent TCP Keep-Alive packages even when using ServicePointManager.SetTcpKeepAlive

别说谁变了你拦得住时间么 提交于 2021-02-07 08:14:30
问题 I want to retrieve some data with an HttpWebRequest (GET): var request = (HttpWebRequest)WebRequest.Create(myUri); request.Timeout = 5 * 60 * 1000; request.ReadWriteTimeout = 5 * 60 * 1000; // request.ServicePoint.SetTcpKeepAlive(true, 5 * 1000, 1000); var response = request.GetResponse(); Unfortunately the computation on the server can take two or more minutes. So between me sending the header and finally receiving the data in the response stream the socket connection is idle. With curl or a

Why does HttpWebRequest not sent TCP Keep-Alive packages even when using ServicePointManager.SetTcpKeepAlive

你。 提交于 2021-02-07 08:11:37
问题 I want to retrieve some data with an HttpWebRequest (GET): var request = (HttpWebRequest)WebRequest.Create(myUri); request.Timeout = 5 * 60 * 1000; request.ReadWriteTimeout = 5 * 60 * 1000; // request.ServicePoint.SetTcpKeepAlive(true, 5 * 1000, 1000); var response = request.GetResponse(); Unfortunately the computation on the server can take two or more minutes. So between me sending the header and finally receiving the data in the response stream the socket connection is idle. With curl or a

python error : 'module' object has no attribute 'AF_UNIX'

蓝咒 提交于 2021-02-07 07:27:42
问题 this is my python code : if __name__ == '__main__': import socket sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) sock.connect(('0.0.0.0', 4000)) import time time.sleep(2) #sock.send('1') print sock.recv(1024) sock.close() it show : Traceback (most recent call last): File "D:\Program Files\test\test\python\client.py", line 3, in <module> sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) AttributeError: 'module' object has no attribute 'AF_UNIX' what can i do , thanks updated:

python error : 'module' object has no attribute 'AF_UNIX'

↘锁芯ラ 提交于 2021-02-07 07:26:46
问题 this is my python code : if __name__ == '__main__': import socket sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) sock.connect(('0.0.0.0', 4000)) import time time.sleep(2) #sock.send('1') print sock.recv(1024) sock.close() it show : Traceback (most recent call last): File "D:\Program Files\test\test\python\client.py", line 3, in <module> sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) AttributeError: 'module' object has no attribute 'AF_UNIX' what can i do , thanks updated:

'WinError 10013' running Django on Windows

最后都变了- 提交于 2021-02-07 07:14:52
问题 It has been almost a month since I got this problem, and I really appreciate your help. While trying to login in my Django Web App, i encounter OSError at /accounts/login/.I am able to login in 127.0.0.1:8000/admin, but not in the /accounts/login which produces the Error Code: OSError at /accounts/login/ [WinError 10013] An attempt was made to access a socket in a way forbidden by its access permissions Request Method: POST Request URL: http://127.0.0.1:8000/accounts/login/ Django Version: 1