I have created a simple tcp based "echo protocol" and notice that I suffer from handle leak on the server when the client forcibly closes the connection (sends a reset).
I catch the ConnectionReset and dispose the socket in the same way I do when the socket is closed (socket.Shutdown and socket.close). As anybody encountered such a prob...
Hi ,
Could someone please tell us if EWOULDBLOCK. works sendto()?
If yes! please give an example ... thanks!
If not, is there anything similar to accept error?
Thanks for your replies
...
In C, when making a networking client / server setup, I usually have to do some standard BSD socket setup. Then on the server side, I'll have to manage multiple threads, usually a main thread, an a io thread. Each connection is managed by a connection manager so that you can have connections being processed while new requests are coming ...
When I call BeginSend on a socket, I pass a delegate which will be called (by a different thread) when the data has been sent.
What would happen if I call BeginSend another time while the first has not yet been 'callbacked'?
What is the correct behavior to send data? do BeginSend, and on the callback do EndSend and start another send? ...
hey.
im programming sockets in c#
i have 2 nics installed on 1 pc
both are in diffrent networks.
im sending a packet thru one of them towards the other nic's ip.
i need the packet to be forwarded thru the wire to another pc with the same ip. not to the inner nic.
im looking for a way to trick windows on this. or just set some basic setti...
I have a c++ program which performs one function. It loads a large data-file into an array, receives an array of integers and performs a lookup in that array, returning a single integer. I am currently calling the program with each integer as an argument, like so:
$ ./myprogram 1 2 3 4 5 6 7
I also have a ruby script, and I would like...
Hi,
I want to implement a simple firewall using raw sockets. I found some sniffer samples but I want to know if it is possible to drop unwanted packets using raw sockets. It is very important for me. Please let me know how can I do that?
...
When working with NIO sockets in Java, once I'm connected I can either register for both read and write operations and just do nothing whenever I get a write notification and I have nothing in the outbound buffer, or I can register for read notifications only and re-register for read and write only when something is placed in the outboun...
Hi All,
I know the similar question may have been asked many times, but I want to represent the behavior I'm seeing and find if somebody can help predict the cause of this.
I am writing a windows service which connects to other windows service over TCP.
There are 100 user entities of this, and 5 connections per each. These users perfor...
From the below piece of code, why I am getting Reading Socket for response
int Read(int sock, char *p, int size)
{
int remain, read=0;
remain = size;
while (remain > 0 ) {
if ((read = recv(sock, p, remain, 0)) < 0) {
/* Error */
return(read);
} else if (read == 0 || *p == 0x0a) {
...
The recv() library function man page mention that:
"It returns the number of bytes received. It normally returns any data available, up to the requested amount, rather than waiting for receipt of the full amount requested."
If we are using blocking recv() call and requested for 100 bytes:
recv(sockDesc, buffer, size, 0); (where siz...
I have made a server and a client in C# which transfers files. But when transferring it pauses for some seconds and then continues. I have uploaded a video on YouTube to demonstrate: http://www.youtube.com/watch?v=GGRKRW6ihLo
As you can see it sometime pauses and then continues.
Receiver:
using (var writer = new StreamWriter(P...
Hi folks
I have been trying to find any way for writing asynchronously on a stream in Cocoa.
I have a set of events in my applications which will try to send data through the socket but i can't be blocked during this transmission due to design terms.
I have tried setting a delegate on the output stream and check the event NSStreamEven...
I assume that when I do a read on the inputstream, it blocks until it gets more data to read.
I also assume that when the connection is closed, the read throws an IOException.
The problem is that sometimes when I change the connection from carrier to WiFi or from WiFi to carrier, the read just gets stuck and never throws the IOException...
I'm very new to Java, and I'm trying to modify an example of a socket server to power a flash-based game. To allow flash to connect to the server, I need to serve up a policy file.
I've never coded a server application before, so I'm not too familiar with the things which need to happen.
Anyway, I have made it so that it outputs the fi...
I would like to send data between two ethernet interfaces that are connected with a crossover cable in Linux. The two ethernet interfaces are on the same box. I defined the ethernet interfaces to have different static ip addresses (1.2.3.4 and 5.6.7.8) and have been using sockets to send bytes from one IP address to the other. I want ...
How to flush Input Buffer (if such thing exists at all) of an UDP Socket in C ?
I'm working on an embedded Linux environment and using C to create some native application. There are several of these embedded machines on the same network, and when an event occurs on one of them (lets call it the WHISTLE-BLOWER), WHISTLE-BLOWER should sen...
Hi,
Why does the client end of a connection
use high port number(ephemeral ports) whereas the applications
listen on typically small port numbers ?
Thx in advans,
Karthik Balaguru
...
I am writing a general Client-Server socket program where the client sends commands to the Server, which executes it and sends the result to the Client.
However if there is an error while executing a command, I want to be able to inform the Client of an error. I know I could send the String "ERROR" or maybe something like -1 etc, but th...
Hello. I'm writing an asynchronous server and client with C#. I took sample code from MSDN, modified and made it to send and receive messages several times. I tried to connect 5 and more clients to server and it worked but on 98th iteration each client throws an exception StackOverflow. Can anybody explain me why I get this error? I've r...