sockets

Is there a way to locate a TCP Server running under local network?

Is there a way to locate a TCP Server running under local network using raw sockets and C#? -The Client searching for the Server is running under the same local network as the Server and it knows the port the Server is running with. -is it by Broadcast? ...

How can I listen on multiple sockets in Perl?

I want to listen on different sockets on a TCP/IP client written in Perl. I know I have to use select() but I don't know exactly how to implement it. Can someone show me examples? ...

How to get a more stable socket connection in Linux/C.

I'm running a game website where users connect using an Adobe Flash client to a C server running on a Fedora Linux box. Often users complain about disconnects. Usually they're "Connection reset by peer"-disconnects. Is there any way to make the connection more stable or does it all depend on the route from the user host to my server?...

Send raw ethernet packet with data field length in type field

I'm trying to send a raw ethernet frame with the length of my data written in the type field. This should be a valid ethernet frame. My code for this looks like this: ethData = "foobar" proto =len(ethData) if proto < 46: proto = 46 soc = socket.socket(socket.AF_PACKET, socket.SOCK_RAW, proto) soc.bind((iface, proto)) For some rea...

Filtering UDP loopback on Linux in C

Hi, I have an application bound to eth0, sending UDP packets on port A to 255.255.255.255. At the same time, I have a UDP server bound to eth0, 0.0.0.0 and port A. What I want to do is to make sure that the server won't receive messages generated by the application (handled purely in software by the kernel) but it will receive messages ...

Perl socket programming problems after continuous write to socket

I am using IO::Socket::INET to create socket like this: $lsn1 = IO::Socket::INET->new( PeerAddr => '192.168.0.2', PeerPort => 1850, Proto => 'tcp', Type => SOCK_STREAM ) || die "Can't connect to 192.168.0.2:1850 :...

C++ socket message contains extra ASCII 0 character

So this is a really strange problem. I have a Java app that acts as a server, listens for and accepts incoming client connections, and then read data (XML) off of the socket. Using my Java client driver, everything works great. I receive messages as expected. However, using my C++ client driver on the first message only, the very first c...

SocketException when connecting to server

I am running both client and server on the same machine. Does any 1 know the error stated above? server using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Threading; using System.Net.Sockets;...

Socket communication on a machine with more than 1 IP address

I have a service which listens for incoming connections on a TCP\IP port number say 7000. Also my machine is having more than 1 NIC cards and more than 1 IP address.( in other words i am having 2 LANs, LAN and LAN2 and 2 Ips). Now I have configured my client application(in another machine with only 1 IP) to establish a connection to my ...

socket return 'No such file or directory"

Hello, Linux GCC 4.4.2 I am doing some socket programming. However, I keep getting this error when I try and assign the sockfd from the socket function. " Socket operation on non-socket" Many thanks for any advice, #if defined(linux) #include <pthread.h> /* Socket specific functions and constants */ #include <sys/types.h> #include...

Socket Send error

Hi, I am using a unix socket. When buffer is send to the socket it gives me unknown error 196. Please help on this. BOOL SendData(int iBuffer) { //Send data over socket int nRet = send(m_listenSock, m_cBuffer, iBuffer, 0); if(SOCKET_ERROR > nRet) { //log the error char temp; int length= sizeof(int); ...

Socket Send error as Broken Pipe

Hi, From A TCP client when i call the send to server. It is giving Broken Pipe error. ...

Could not be performed exception using a socket to do a UDP Multicast

When running a C# app I created on XP it runs just fine, but under Windows 7, I get the following error: "An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full" I am doing the following: socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolTy...

Performance of sockets vs pipes

I have a Java-program which communicates with a C++ program using a socket on localhost. Can I expect to gain any performance (either latency, bandwidth, or both) by moving to use a native OS pipe? I'm primarily interested in Windows at the moment, but any insight related to Unix/Linux/OSX is welcome as well. EDIT: Clarification: both ...

Is there a way to wait for a listening socket on win32?

I have a server and client program on the same machine. The server is part of an application- it can start and stop arbitrarily. When the server is up, I want the client to connect to the server's listening socket. There are win32 functions to wait on file system changes (ReadDirectoryChangesW) and registry changes (RegNotifyChangeKey...

Checking for presence of .NET remoting server - is my approach correct?

It's not possible to set a connection timeout on a .NET remoting call. Documentation occasionally refers to TcpChannel properties that allegedly do this, but discussions and the most recent docs I've found indicate that this is not possible. One may set a timeout on the remoting call itself, but not on the initial connection attempt. ...

QAbstractSocket::UnknownSocketError

What could be cause of QAbstractSocket::UnknownSocketError when using QTcpSocket? CODE I'm getting this error code with the following code: this->connect(socket, SIGNAL(socketError(QAbstractSocket::SocketError)), SLOT(handleSocketError(QAbstractSocket::SocketError))); ... void MyClass::handleSocketError(QAbstractSocket::SocketError ...

TCP send/recv error reporting

I have a client/server program (Windows, winsock2) which communicates over TCP. The client connects and sends data to server (using send) in 8K at a time. The server just reads data (using recv). No special settings done on sockets. Problem: When some network error occurs during the communication (e.g. cable pulled out), receiver do no...

TCP Socket Piping

Suppose that you have 2 sockets(each will be listened by other TCP peers) each resides on the same process, how these sockets could be bound, meaning input stream of each other will be bound to output stream of other. Sockets will continuously carry data, no waiting will happen. Normally thread can solve this problem but, rather than cre...

Socket Programming C/C++ - recv function hangs?

My recv function hangs while getting reponse from server. Client side code in c/c++: void sockStuff() { int sock, bytes_recieved,bytes_send; char send_data[1024], recv_data[4096]; struct hostent *host; struct sockaddr_in server_addr; host = gethostbyname("127.0.0.1"); if ((sock = socket(AF_INET, SOCK_STREAM, 0)) == -1) { pe...