sockets

python receiving image from socket stream

主宰稳场 提交于 2021-02-11 08:04:02
问题 I'm trying to send a frame and throw socket by python, using opencv . The image is sent as string stream but when i remake the image on the server,the bytes are not in the right order. Client code : import socket import numpy as np import cv2 UDP_IP = "127.0.0.1" UDP_PORT = 5005 cap = cv2.VideoCapture(1) sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) while 1: ret, frame = cap.read() cv2.imshow('client', frame) d = frame.flatten() s = d.tostring() #sock.sendall(s) #print len(s) for i

How to specify the port that the client side of socket in PHP?

女生的网名这么多〃 提交于 2021-02-11 06:55:54
问题 I want to bind a specified port to the CLIENT side of socket in PHP. Can I do this? How to do this? Using socket_bind()? but I dont know what should be set for the address I have googled the solution about this question but no example/solution can be found. Thanks for helping. 回答1: Look here: http://php.net/manual/en/function.socket-bind.php socket_bind ( resource $socket , string $address [, int $port = 0 ] ) So something like: socket_bind($socket, 'localhost', 5555); Of course, I don't know

C# application control local network iOS

こ雲淡風輕ζ 提交于 2021-02-11 06:29:02
问题 I'm in the middle of the process of making an application on Windows in C# and I want to make an IOS and an Android program. Things are going well, but I'm kind of stuck on implementing the requirements for proper network communication. I've searched a lot on sockets and I'm quite sure that I have to use that but I don't know for sure. I can't really find much about it. So I was wondering if you guys could point me in the right direction. So my question basically is how to establish

is this even possible? send commands/objects from one python shell to another?

故事扮演 提交于 2021-02-11 06:26:10
问题 I have a question I wasn't really able to solve after doing a little digging, and this is also not my area of expertise so I really don't even know what I'm looking for. I'm wondering if it's possible to "link" together two python shells? This is the actual use case... I am working with a program that has it's own dedicated python shell built into the GUI. When you run commands in the internal python shell, the GUI updates in real-time reflecting the commands you ran. The problem is, the

Boost receive data from the tcp socket

折月煮酒 提交于 2021-02-11 01:16:36
问题 I am trying to read specific number of bytes from the socket. My server is sending: 1) byte[0] - length of the message 2) byte[1:N] - the actual message How do I read the first byte and then read the remaining bytes using boost::asio::ip::tcp::socket::read ? Here is the code snippet: // receive data through the socket void TCPTestClient::ReceiveData( ) { try { boost::system::error_code error; boost::asio::streambuf receivedStreamBuffer; // reserve 512 bytes in output sequence boost::asio:

Boost receive data from the tcp socket

我是研究僧i 提交于 2021-02-11 01:13:11
问题 I am trying to read specific number of bytes from the socket. My server is sending: 1) byte[0] - length of the message 2) byte[1:N] - the actual message How do I read the first byte and then read the remaining bytes using boost::asio::ip::tcp::socket::read ? Here is the code snippet: // receive data through the socket void TCPTestClient::ReceiveData( ) { try { boost::system::error_code error; boost::asio::streambuf receivedStreamBuffer; // reserve 512 bytes in output sequence boost::asio:

Socket Programming Pointer Error

試著忘記壹切 提交于 2021-02-10 23:54:38
问题 I am trying to learn a bit of socket programming, I am also pretty new to c and having some trouble creating my server. I am having trouble with pointers and the error I get when I try to run the code is warning: passing 'int *' to parameter of type 'socklen_t *' (aka 'unsigned int *') converts between pointers to integer types with different sign [-Wpointer-sign]` My server code is as follows, can anyone help with the error I am getting? Any other tips or comments are welcome as well

Socket Programming Pointer Error

戏子无情 提交于 2021-02-10 23:48:18
问题 I am trying to learn a bit of socket programming, I am also pretty new to c and having some trouble creating my server. I am having trouble with pointers and the error I get when I try to run the code is warning: passing 'int *' to parameter of type 'socklen_t *' (aka 'unsigned int *') converts between pointers to integer types with different sign [-Wpointer-sign]` My server code is as follows, can anyone help with the error I am getting? Any other tips or comments are welcome as well

.Net UDP packet loss though all packets arrive (Wireshark) - ReceiveBuffer not the issue

橙三吉。 提交于 2021-02-10 19:44:18
问题 This is the same question as C# UDP packetloss though all packets arrive (WireShark), except I do set ReceiverBuffer to 10MB, and I also monitor Socket.Available which shows the buffer doesn't even reach 200k utilization. In a simple test case, sending the same small (multicast) UDP packet (net data size: 137) 25,000 times using tcpreplay with at rate of 40Mbps, oftentimes not all packets arrive in my program, although all packets arrive in Wireshark, which I run at the same time on that box.

How to implement a keep alive connection on a TCP connection using spring integration?

﹥>﹥吖頭↗ 提交于 2021-02-10 18:44:44
问题 I've a TCP client which was built using spring integration TCP and the server supports a keep alive message (ping/pong style). The connections were configured using a CachingClientConnectionFactory and I'd like to take advantage on this server feature. Here's my bean configuration: private static final int SERIALIZER_HEADER_SIZE = 2; /** * Serializer used by connection factory to send and receive messages */ @Bean public ByteArrayLengthHeaderSerializer byteArrayLengthHeaderSerializer() {