sockets

Why does UdpClient.Receive require a ref parameter?

Why is the parameter on UpdClient.Receive a ref parameter, instead of simply out? According to the MSDN page, the parameter is filled with the address that the datagram was sent from. However it doesn't specify what kind of input it is used for, only output. ...

Using LINQ, need help splitting a byte array on data received from Silverlight sockets

The message packats received contains multiple messages deliniated by a header=0xFD and a footer=0xFE // sample message packet with three // different size messages List<byte> receiveBuffer = new List<byte>(); receiveBuffer.AddRange(new byte[] { 0xFD, 1, 2, 0xFE, 0xFD, 1, 2, 3, 4, 5, 6, 7, 8, 0xFE, 0xFD, 33, 65, 25, 44, 0xFE}...

I want close a CFSocket

Hi, I have create a socket with CFSocket. My program is correct but now i wanna close the socket (client side). There is a istruction? Thanks and sorry for my English XP My code: CFSocketRef s; s = CFSocketCreate( NULL, PF_INET, SOCK_STREAM, IPPROTO_TCP, kCFSocketDataCallBack, AcceptD...

Socket Programming for the Web

I have to interact with a legacy system that accepts socket communication and messages. My goal is to make the application cross-platform, but I need the ability to push messages to the client (i.e. - .NET's WCF, Java's Comet) and detect when the user closes out of their browser to destroy the socket. I have built a prototype of .NET w...

Comparing a peer's IPv6 address with localhost

I have called getpeername on my connected socket and now have an IPv6 address of the connected peer. How do I tell whether my peer's IP address is localhost? Edit: To clarify, I mean specifically localhost, as in the loopback IP address. ...

How large should my recv buffer be when calling recv in the socket library

Hi, I have a few questions about the socket library in C. Here is a snippet of code I'll refer to in my questions. char recv_buffer[3000]; recv(socket, recv_buffer, 3000, 0); First, How do I decide how big to make recv_buffer? I'm using 3000, but it's arbitrary. Second, what happens if recv() receives a packet bigger than my recv_...

Client/Server communication via internet

Hi, Which is the best solution to communicate bidirectionally between a remote server and a client behind an internet box? UPnP with Sockets. HTTPS/Database Server and the client make 1 request every Xsec to know if there is new data. Client opens 1 connection on the server and it maintains open to make a tunnel. Thanks in advan...

how to log or store the request and response between host and my application in python

we have an application through which we connect to remote host on port 23 and we have to do some repetative work.. what i am thinking is while runnig that application manually can i log or store the request that apllication sending to remote host and what resposes application receving to that request i have to run my application and at...

Getting "Illegal Seek" error after calling accept()

Well.. it's pretty much that, I seem to be getting a "Illegal Seek" error when checking my errno variable. The problem is that I have no idea of what that can mean. I know sockets are treated like files in unix, but I can't see how can this be related to sockets. What I'm doing exactly is: int sck = ::accept(m_socket, (struct sockaddr*...

multiple clients - one server connection with sockets tcp/ip c# .net

Hello guys, I need to develop a client server system where I can have multiple clients communicating with one server at the same time. I want to communicate xml serialized objects and also need to send and receive other commands to invoke methods. Now, I am just starting with socket programming in C# and .Net and found that the asynchron...

How to detect a Socket disconnection?

I've implemented a task using the async Sockets pattern in Silverlight 3. I started with Michael Schwarz's implementation and built on top of that. So basically, my Silverlight app establishes a persistent socket connection to a device and then data flows both ways as necessary between the device and the Silverlight app. One thing I a...

Need Help finding an appropriate task assignment algorithm for a college project involving coordinating in the field workforce through PDAs

I am a long time lurker here and have found over time many answers regarding jquery and web development topics so I decided to ask a question of my own. This time I have to create a c++ project for college which should help manage the workflow of a company providing all kinds of services through in the field teams. The ideas I have so ...

Is there a way to specify the local port to used in tcpClient?

Hi: I am currently using this function call to create my tcpClient: clientSocket = new TcpClient("localhost", clientPort); But the clientPort is the server's port. Is there a way for me to specify the client port using tcpClient? Thanks ...

Why is Perl's IO::Socket::SSL->new() failing?

When I execute this line: $client = IO::Socket::SSL->new("pilot-payflopro.paypal.com:443"); my IO::Socket::SSL::errstr() is configuration error failederror:00000000:lib(0):func(0):reason(0) my $! is 'invalid argument' Has anyone run into this before? ...

Hold a network connection although IP address change

Hi, Is it possible to hold an open TCP connection with a client, while the IP address of the client is externally changed? For example, the connection is establishes against address X, but somewhen while the connection is open, the client-side user asks for IP renew and gets another IP address. Can the connection remains alive in this c...

.NET equivalent of recv?

I have a portion of C code that I am trying to port over to C#. In my C code, I create a socket and then issue a receive command. The receive command is void receive(mysocket, char * command_buffer) { recv(mysocket, command_buffer, COMMAND_BUFFER_SIZE, 0); } Now, the command buffer is returned with new values including command_bu...

Most efficient way for testing links

I'm currently developping an app that is going through all the files on a server and checking every single hrefs to check wether they are valid or not. Using a WebClient or a HttpWebRequest/HttpWebResponse is kinda overkilling the process because it downloads the whole page each time, which is useless, I only need to check if the link do...

Linux: is here a read or recv from socket with timeout?

Hello How can I try to read data from socket with timeout? I know, select, pselect, poll, has a timeout field, but using of them disables "tcp fast-path" in tcp reno stack. The only idea I have is to use recv(fd, ..., MSG_DONTWAIT) in a loop ...

how to send an array of bytes over a TCP connection (java programming)

Can somebody demonstrate how to send an array of bytes over a TCP connection from a sender program to a receiver program in Java. byte[] myByteArray (I'm new to Java programming, and can't seem to find an example of how to do this that shows both ends of the connection (sender and receiver.) If you know of an existing example, maybe y...

How to limit traffic using multicast over localhost

I'm using multicast UDP over localhost to implement a loose collection of cooperative programs running on a single machine. The following code works well on Mac OSX, Windows and linux. The flaw is that the code will receive UDP packets outside of the localhost network as well. For example, sendSock.sendto(pkt, ('192.168.0.25', 1600)) ...