An instance of System.Net.Sockets.Socket
can be shared by 2 threads so one use the send() method and another it's receive() method ?
Is it safe?
Well, I need it to be not only thread-safe, but also that the send/receive methods be non-syncronized, so as to let each thread call them concurrently.
Do I have another way of doing it ?
T...
I need my program to check if a given Windows process is abusing the network.
I would like to enumerate the process tcp and udp sockets, and see how much data they transferred during a given period.
Is there a C or .Net API that can provide such info?
...
Hi,
I'm sending a large amount of data in one go between a client and server written C#. It works fine when I run the client and server on my local machine but when I put the server on a remote computer on the internet it seems to drop data.
I send 20000 strings using the socket.Send() method and receive them using a loop which does s...
Hi all,
If I'm only WRITING to a socket on an output stream, will it ever block? Only reads can block, right? I am asking because someone told me writes can block but I only see a timeout feature for the read method of a socket - socket.setSOTimeout(). It doesn't make sense to me that a write could block but I'd like to hear for sure...
Hi to all,
I want to connect a device [a kind of modem] over TCP-Protocol.
The device could be considered as a client. Over a program I want
to connect to this device. The program is located on a server and
has a special port open and a static ip.
How can I do it?
Here is my code :
// where ip= 10.0.0.50 and port= 5050, estab...
I have a sender that TCP-connects, sends block of data, and closes the socket.
I'd like to write the simplest, but reliable program that does the above.
The first thing comes into mind (e.g. in .NET, although the question relevant to sockets in general):
// assuming LingerOption(false), NoDelay set to whatever
var client = new TcpClient...
I've got a client app which has to connect to a server and register for waiting, that is, it wants to be notified when the server is done with some processing. Ideally, I want to keep this client as simple as possible, but the question is, how to "register for waiting". I could keep the socket open and do a blocking read, and as soon as ...
I have some networking code which connects to a multicast address but disconnects after a few seconds. Can anyone figure out what's wrong with this code?
String Target_IP = "224.1.2.3";
int Target_Port = 31337;
IPEndPoint LocalEP = new IPEndPoint(IPAddress.Any, Target_Port);
IPEndPoint RemoteEP = new IPEndPoint(IPAddress.Parse(Target_...
Below is the definition of sockaddr_storage structure (rfc2553). According rfc2553, the sockaddr_storage
should be aligned with 64 bit boundary and it should be able to hold both sockaddr_in and sockaddr_in6.
Also, it must have atlest __ss_family member. Rest of the fields are implementation defined.
#define _SS_MAXSIZE 128 /* Imple...
Hi all,
Im not sure whether this topic have been disscussed or not, but i have no idea what to do. In c#, i need to send message to other people in my networks. I made some researches, and all pointing to socket methods. With this method, logically it will work like this:
open up socket
Encode the message(to ascii for example)
Put the...
I am trying to connect to a piece of hardware via TCP/IP. I had done this very smoothly in VB and am trying to achieve the same result in C#.
The code looks like this:
internal Socket connectSocket(IPEndPoint vIPEndPoint)
{
Socket lclSocket = new Socket(vIPEndPoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
t...
Is there any way to get the local end point of a connected Silverlight TCP socket without having to resort to asking the server?
...
I just read about HTML 5's WebSocket interface. How can I start trying this? What browser versions have implemented this already?
...
I'm doing some fairly simple cross-platform TCP socket programming. I have unfortunately found out that when compiled on Windows, my sockets are non-blocking by default, while on OS X they are blocking by default. How do I force a socket into blocking mode on Windows? Do they normally default to non-blocking mode or is something terribly...
How do I implement a web application with a Servlet that is listening on a port for socket connections?
...
At the first look when using asynchronous methods on the socket level, there shouldn't be problems with sending and receiving data from the associated network stream, or 'directly' on the socket. But, you already probably know, there is.
The problem is particularly highlighted on the Windows Mobile platform and the Compact Framework.
I...
Hi
I seem to be getting this particular always when i am trying to receive data in that socket. The socket is a valid socket and connection is also established and there is some data always that periodically comes in theparticular port. But some how the recv function gives this error. Any idea what may be the cause.
sample code presen...
I have an application that is being built using Qt. It will be running on machines that will have two (or more) network cards. I need the ability for my application to select which ethernet interfaces for a TCP connection. Before anyone suggests it I cannot guarenteed that routing tables will be setup correctly. I know how to do this...
Hi, the MSDN docs for the Connected property on Socket say the following:
The value of the Connected property
reflects the state of the connection
as of the most recent operation. If
you need to determine the current
state of the connection, make a
nonblocking, zero-byte Send call. If
the call returns successfully or
th...
I am using the GetIfTable windows call in C++ with Visual Studio 2005 SP1 on Windows Vista SP2 x86.
For a unit test, I am trying to track the bytes sent and bytes received (dwOctets*) on the loopback adapter (loopback software interface 1 or something or other), but those values are always 0.
Has anyone successfully used the loopback a...