sockets

.NET Equivalant for INET_NTOA and INET_ATON

Any C#/.Net equivalent methods, or managed code examples for INET_NTOA and INET_ATON? ...

What are the options for network programming in Go?

I am looking to write a simple client/server utilizing TCP sockets. Any ideas how to do network programming in Go? ...

Passing structures using sento()

How do I pass following message format from a UDP client to a UDP server? ----------------------------- |Ver|p|fff| length| checksum| ---------------------------- | Customer id | ----------------------------- | Amount | ----------------------------- |other | -------------------------...

can the send function block

I'm writing a chat program and for the server, when I send data can the send() function take a long time to send out the data? Here is my problem: I'm using linux 2.6 with epoll, server in single thread If send() blocks, then this means all other activity on the server will stop. Like if there is a very slow client that does not send AC...

sendto() crashes with error code "Success"

My problem is quite infuriating, actually. I'll show you the code first. /* ** listener.c -- a datagram sockets "server" demo */ //Original Code: Brian Hall ([email protected]) //Commented and modified by Vishal Kotcherlakota (PID A07124450) #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <errno.h> #include <string.h> #i...

Connecting 2 different sub neted computers.

How do I connect 2 different subnet’ed computers? For example sake let’s say the following: 192.168.1.92 connected to externally visible 222.251.155.20. 192.168.1.102 connected to externally visible 223.251.156.23. Now there is middle man server that both machines are connected to so they can negotiate each other’s internal and externa...

Detecting client TCP disconnection while using NetworkStream class

A friend of mine came to me with a problem: when using the NetworkStream class on the server end of the connection, if the client disconnects, NetworkStream fails to detect it. Stripped down, his C# code looked like this: List<TcpClient> connections = new List<TcpClient>(); TcpListener listener = new TcpListener(7777); listener.Start()...

CSocket Server get the client IP Address

How can I get the ip address of a client when he tries to connect to the server? I'm using CSocket class. ...

How do you you run a Twisted application via Python (instead of via Twisted)?

I am working my way through learning Twisted, and have stumbled across something I'm not sure I'm terribly fond of - the "Twisted Command Prompt". I am fiddling around with Twisted on my Windows machine, and tried running the "Chat" example: from twisted.protocols import basic class MyChat(basic.LineReceiver): def connectionMade(s...

Twisted ignoring data sent from MUD Clients?

I have the following code (almost an exact copy of the Chat server example listed here: import twisted.scripts.twistd from twisted.protocols import basic from twisted.internet import protocol, reactor from twisted.application import service, internet class MyChat(basic.LineReceiver): def connectionMade(self): print "Got new...

Unexpected byte sequence returned from IIS 5.1 FTP server

Back when .NET Framework 1.0 was launched, there were no good FTP client implementations available for .NET so I wrote my own implementation using System.Net.Socket. Recently I had to make some changes to it, and while debugging I noticed garbled output from the IIS 5.1 FTP server I'm testing against (WinXP SP 2) when closing the connect...

Fail to open a socket for multicast

Hi, I have problems to open an multicast socket in Erlang to receive messages: 88> gen_udp:open(5353,[{reuseaddr, true}, {ip,{224,0,0,251}},{multicast_ttl,4},{multicast_loop,false},binary]). {error,eaddrnotavail} I checkt diffrent IP addresses and ports and the option {active, false}, but nothing helps. What could be the reason? Tha...

[python] How do I disable Nagle's algoritm for sockets?

Hi! I'm writing some python and are stuck at the moment. I think this "Nagle algoritm" is the problem since my packages are delayed some time for some reason to the client. I've tried this on both client and server but it doesn't seems to work (or there's another problem causing it): socketobj.setsockopt(socket.IPPROTO_TCP, socket.TCP_...

[C#] Getting the IP Address of a Remote Socket Endpoint

How do I determine the remote IP Address of a connected socket? I have a RemoteEndPoint object I can access and well as its AddressFamily member. How do I utilize these to find the ip address? Thanks! Currently trying IPAddress.Parse( testSocket.Address.Address.ToString() ).ToString(); and getting 1.0.0.127 instead of 127.0.0.1 fo...

TCP Socket Error: Only one usage of each socket address (protocol/network address/port) is normally permitted

Hi. i am developing a small TCP Client/Server lib. i am facing this problem when i create a client and connect it to server. it gives me this exception Only one usage of each socket address (protocol/network address/port) is normally permitted my code is. public TCPClient(string remoteIPAddress, int port) { this...

cancel read operation

DataInputStream in; byte[] b = new byte[1024]; for (;;){ in.read(b); //do something } I have the above code. In another thread i am handling some other events. In this thread i want to cancel the read operation shown in the above code. How can i do? ...

socket pairs, perl, KEEPALIVE, and polling

I've starting using socketpairs on linux and windows in order to capture the output of subprocesses on both platforms. I do this by copying STD* onto one of the sockets in the socketpair (I'm using Win32::SocketPair in perl for socketpair's on windows). The main reason I am doing this is so that read do NOT block on the output file han...

CSocket doesn't receive OnClose or OnReceive when you disable network connection on the client side

I've created a client server application with c++ CSocket. when I connect the client to the server and after that I close the client with normal X button or end task it with taskmanager , server CSocket receives the OnClose event. The problem is when I disable the internet connection on windows that the client is running on, server CSock...

C/Python Socket Performance?

Hi, my question simply relates to the difference in performance between a socket in C and in Python. Since my Python build is CPython, I assume it's similar, but I'm curious if someone actually has "real" benchmarks, or at least an opinion that's evidence based. My logics is as such: C socket much faster? then write a C extension. n...

Socket closing problem - last portion of data is lost.

I have a Java program that accepts connections, receives HTTP requests and sends HTTP replies and some data stored in file (this is a part of caching proxy). Removing everything irrelevant, my code looks like this: FileInputStream fileInputStream = new FileInputStream(file); OutputStream outputStream = socket.getOutputStream(); byte[] b...