sockets

How to send and receive messages from function other than registered callback function in Netlink socket?

左心房为你撑大大i 提交于 2021-02-18 19:10:14
问题 In following kernel module, I hooked syscall sys_open, and now trying to send filename to process in userspace using Netlink socket, in response process will return a msg, and then according to msg, the kernel module will proceed further. source code: foo.c #include <linux/module.h> #include <linux/init.h> #include <linux/types.h> #include <asm/uaccess.h> #include <asm/cacheflush.h> #include <linux/syscalls.h> #include <linux/delay.h> // loops_per_jiffy //===============netlink===============

How to send and receive messages from function other than registered callback function in Netlink socket?

别等时光非礼了梦想. 提交于 2021-02-18 19:10:12
问题 In following kernel module, I hooked syscall sys_open, and now trying to send filename to process in userspace using Netlink socket, in response process will return a msg, and then according to msg, the kernel module will proceed further. source code: foo.c #include <linux/module.h> #include <linux/init.h> #include <linux/types.h> #include <asm/uaccess.h> #include <asm/cacheflush.h> #include <linux/syscalls.h> #include <linux/delay.h> // loops_per_jiffy //===============netlink===============

How to send and receive messages from function other than registered callback function in Netlink socket?

混江龙づ霸主 提交于 2021-02-18 19:07:13
问题 In following kernel module, I hooked syscall sys_open, and now trying to send filename to process in userspace using Netlink socket, in response process will return a msg, and then according to msg, the kernel module will proceed further. source code: foo.c #include <linux/module.h> #include <linux/init.h> #include <linux/types.h> #include <asm/uaccess.h> #include <asm/cacheflush.h> #include <linux/syscalls.h> #include <linux/delay.h> // loops_per_jiffy //===============netlink===============

Disconnect UDP socket in python?

試著忘記壹切 提交于 2021-02-18 18:13:38
问题 I need to 'disconnect' a UDP socket in python(and not close it!). Is it possible to do the equivalent of: int disconnect_udp_sock(int fd) { struct sockaddr_in sin; memset((char *)&sin, 0, sizeof(sin)); sin.sin_family = AF_UNSPEC; return (connect(fd, (struct sockaddr *)&sin, sizeof(sin))); } taken from here in python without interfacing the function? 回答1: Looking at socketmodule.c in the Python 2.7 sources, it doesn't seem possible. You really need to define and call the C function above. 来源:

Disconnect UDP socket in python?

为君一笑 提交于 2021-02-18 18:09:04
问题 I need to 'disconnect' a UDP socket in python(and not close it!). Is it possible to do the equivalent of: int disconnect_udp_sock(int fd) { struct sockaddr_in sin; memset((char *)&sin, 0, sizeof(sin)); sin.sin_family = AF_UNSPEC; return (connect(fd, (struct sockaddr *)&sin, sizeof(sin))); } taken from here in python without interfacing the function? 回答1: Looking at socketmodule.c in the Python 2.7 sources, it doesn't seem possible. You really need to define and call the C function above. 来源:

Which bi-directional ZeroMQ pattern should I use for multiple clients connecting to a single server?

与世无争的帅哥 提交于 2021-02-18 12:33:05
问题 I have multiple ( 1000s ) of clients connecting to a single server and sending some log data. The server analyses the data and responds, if necessary. PUB / SUB is one directional (monitor example ). REQ / REP cannot identify the peer and reply specifically to a peer ( it is more for ACK and such only ). I need to register these clients, identify them and be able to respond after analysis of their logs. With sockets, I have the client sockets, after accept and I can respond using that socket

Python 3.4 multiprocessing Queue faster than Pipe, unexpected

冷暖自知 提交于 2021-02-18 08:56:50
问题 I am doing an audio player that received samples from an udp socket, and everything was working fine. But when I implemented an Lost Concealment algorithm, the player failed to keep producing silence at the excepted rate (each 10ms send a list of multiple 160 bytes). When playing audio with pyaudio, using the blocking call write to play some samples, I noticed it blocked on average for duration of the sample. So I created a new dedicated process to play the samples. The main process processes

what is servaddr.sin_addr.s_addr=INADDR_ANY [duplicate]

試著忘記壹切 提交于 2021-02-18 08:42:08
问题 This question already has answers here : Sockets - Using INADDR_ANY on client side (4 answers) Closed 3 years ago . In socket programming what does servaddr.sin_addr.s_addr=INADDR_ANY; in a client program do actually? What does INADDR_ANY mean? Also in another source found in the internet, I found servaddr.sin_addr.s_addr=inet_addr(argv[1]); What is this step doing? I think I have to enter the server ip as argument in that client wants to get connected to. Am I correct? 回答1: On a server,

Windows - Wait on event and socket simulatenously

烂漫一生 提交于 2021-02-18 07:47:59
问题 I'm writing Win32-API C code that needs to wait for new TCP connections and on the other side can be closed at any time by any other process/thread. Therefore, I need to somehow WaitForSingleObject on the stop event and wait for connections using WSAAccept simultaneously. I tried WaitForMultipleObjects on both socket and handle but new connection won't trigger the function (also WaitForSingleObject on the socket won't be triggered on a new connection). Any idea? 回答1: You need to use

Android listen for messages from server socket

ε祈祈猫儿з 提交于 2021-02-17 20:08:23
问题 I am trying to create an android app that communicates with a local server through a socket. The communication passes simple commands and data in strings using JSON. The client should constantly listen to incoming messages from the server and update the user interface when new data is received. So i have created a network service which is a bound service running in the background. From my activity i bind to the service and receives an instance of the service object. The service object