While trying the following the address in the second sockaddr changes:
/*Stuff*/
sockaddr add1, add2;
recvfrom(/*socket*/, /*buffer*/, /*count*/, /*flag*/, &add1, /*fromlen*/);
add2 = add1; //The sa_data - part changes O_o...
/*Stuff*/
Anyone knows why?...
EDIT: 1.I changed the sockaddr to sockaddr_storage which definetly has enou...
Hi all
We want to implement a server/client application for internal use. Does anyone have know how to implement an application protocol based on the socket?
Best Regards,
...
I have a thread that sits in a blocking recv() loop and I want to terminate (assume this can't be changed to select() or any other asynchronous approach).
I also have a signal handler that catches SIGINT and theoretically it should make recv() return with error and errno set to EINTR.
But it doesn't, which I assume has something to do ...
Idea:
I want to make smth like real time electronic blackboard. Many users have one board at the screen and can draw smth at the same time, and board will update.
Implementation:
I have multi user Socket server thats allow chatting (blackboard will be new feature), i need when one user drew smth the borad should update to other users(ma...
I'm trying to use a socketpair to have a parent process provide input to a child process that execs a different program (e.g., grep) and then read the resulting output. The program hangs in the while loop that reads the output from the program that the child execs.. The child dupes stdin and stdout on to its end of the socketpair and the...
So, here is some code:
obj.HOST = ""
obj.PORT = int(port.get()) # it's 100% correct PORT number
obj.srv = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
obj.srv.bind((obj.HOST, obj.PORT))
obj.srv.listen(1)
obj.sock, obj.addr = obj.srv.accept()
class Client(threading.Thread):
def __init__(self,from_):
if from_.ip.get() =...
I have an application which works with sockets and reads / writes data. It uses Foundation framework combined with CFNetwork and stdio.
Here is the issue - when it is launched from console (bash shell) it works 100% fine and there is nothing wrong with. However when it is invoked by another application via NSTask madness begins. The who...
Im trying to run a thread that goes to a socket, grabs the input stream, and reads it. Im creating hundreds of these threads and have set the timeout for reading and yet the thread still stays at the read() line.
public void readPack() {
socket.setSoTimeout(4*1000);
if (socket.isConnected()) {
buffer parse = new buffer();
...
Can a socket be closed from another thread when a send / recv on the same socket is going on?
Suppose one thread is in blocking recv call and another thread closes the same socket, will the thread in the recv call know this and come out safely?
I would like to know if the behavior will differ between different OS / Platforms. If yes, h...
I have a local server written in C++ listening to inbound TCP connects using plain socket ::accept() and UDP recvfrom(). I have two problems with this that I wish to solve:
Can I programatically make Windows let me open the accept socket without it automatically being blocked by the Windows (software) firewall?
Are there any ports I ca...
I'm trying to listen on a port using ServerSocket on an Android device. I want to be able to connect to this port over WiFi using a computer on the same network.
I get no exception when binding it to a port, however when I check netstat it says:
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 ...
My question is next:
I want to write a program which should connect to the same program on the other machine, and both this program should exchange some information. I can't set up non-blocking connection. How can it be?
...
I recently finished this book on Managed C++, and found it very interesting... But I realize the topic is woefully out-of-date now, with the advent of C++/CLI.
So I'm looking for recommendations on a new book to read, something to update my knowledge of C++ and .NET. I'm especially interested in writing server applications (using socke...
I have a custom HTTP server that implements the HTTP 1.1 protocol.
I have no problem using persistent connections, however, I never receive 'Connection: Close' from IE ( I haven't tested other browsers. ) Instead, the 'receive' times out because it seems IE closes the connection.
What header from IE should I look for to gracefully clo...
I tried the MSDN code edited that, but still the problem is that when I send 271 bytes data, my WSARecv() shows me 542 byte data, which is just duplicate copy.
How can I overcome this problem?
http://msdn.microsoft.com/en-us/library/ms741688(v=VS.85).aspx
http://msdn.microsoft.com/en-us/library/ms742203(v=VS.85).aspx
...
I had this working previously, but I didn't understand how, so I'm attempting to rewrite a bit of code.
Everything seems to be going fine, except when I try to use getaddrinfo(), I'm getting back a result of -7, which translates into the error "ai_socktype not supported".
I'm willing to bet it's simply me still getting a handle on poin...
I need to connect to a remote host and exchange data with some binary protocol. I'm connecting with:
CFStreamCreatePairWithSocketToHost(NULL, (CFStringRef)@"whatever.host.com",
port, &readStream, &writeStream);
Everything is fine, except the error handling. I'm
handling NSStreamEventErrorOccurred in my stream's delegate...
Hi,
We have a production system that gathers telemetry data from remote devices. This data is sent at a reasonable frequency and we end up receiving up to thousands of messages a second at peak times. The payload is circa 80 bytes per message. I am starting to do some performance testing of various storage machanisms, but I thought fir...
I'm having a problem where a socket appears to be closing by itself.
Here's the (edited) network diagnostic trace:
Exiting Socket#62696216::BeginSend()
Exiting Socket#62696216::EndSend()
Socket#62696216::BeginSend()
Exception in the Socket#62696216::BeginSend - An established connection was aborted by the software in your host machi...
I want to set the maximum of connection. If it more than the maximum, tell the client now server is full and close the socket.
How to write code in C ?
Thank you.
...