sockets

In .NET how to detect if the TCP port on the server is opened and/or active?

I need to establish a TCP connection with a remote machine, but before I do that, I need to detect, if the port is in use by another application (if there is already one connection on this port). In other words I want to ensure that only one application is using the same port a time. What is the way to do it in .NET? ...

weblogic.utils.NestedRuntimeException: Cannot parse POST parameters of request

Hi, When i click on a link which sends post http request (Ajax) to a webwork action, i am getting the following error. The issue is sporadic in nature. What are the possible root causes and fixes for this issue? Any help is highly appreciated. weblogic.utils.NestedRuntimeException: Cannot parse POST parameters of request: '/bold/profi...

Socket re-connection failure

System Background: Its basically a client/server application. Server is an embedded device and Client is a windows app developed in C++. Issue: After a runtime of about a week, communication breaks between client/server, because of this the server is not able to connect back to the client and needs a restart to recover. Looks like Syst...

How to detect client disconnection on PHP socket listener?

Hi all, I've been testing PHP socket listening, and ran into the aforementioned problem. My test listener works otherwise fine, but if a client disconnects without telling the server, the script goes into and infinite loop until a new client connects. The problem seems to be on line $ready = socket_select($read, $write = NULL, $except =...

Best way to pass data between two servers in C?

I wrote a program that creates a TCP and UDP socket in C and starts both servers up. The goal of the application is to monitor requests over the TCP socket as to what UDP packets to send it (i.e. monitor for something like "0x01 0x02" and if I see it, then have the UDP server parse the payload, and forward it over to the TCP server for p...

Android Multicast socket stops listening

I have a service on Android that listens and responds to packets it receives via multicast. This works most of the time, but unfortunately, I'm finding that every now and again it'll just stop receiving packets. The thread remains blocked on the call to MulticastSocket.receive(), but nothing comes out. I've been slowly trying to track d...

how to bind raw socket to specific interface

Hello, My application is running on CentOS 5.5. I'm using raw socket to send data: sd = socket(AF_INET, SOCK_RAW, IPPROTO_RAW); if (sd < 0) { // Error } const int opt_on = 1; rc = setsockopt(m_SocketDescriptor, IPPROTO_IP, IP_HDRINCL, &opt_on, sizeof(opt_on)); if (rc < 0) { close(sd); // Error } struct sockaddr_in sin; memset(&si...

Asynchronous socket I/O on Android

Is there a decent mechanism for doing asynchronous I/O using sockets on Android? I'm aware of the existence of nio channels, but they don't work for me because I need to be able to use MulticastSockets and BluetoothSockets, neither of which support channels. I'm aware the answer is probably that there isn't one, but as this is a fairly...

Broken sockets in .NET ?!

Here's a really strange problem: Apparently, the specific sequence of bytes which translates to ASCII "PUttttt", if sent over a TCP socket doesn't make it to the client at all. I've included the sample code used to demonstrate the problem below in hopes that someone might have an idea as to why this is happening. The server and client ...

Mixing synchronous and asynchronous socket calls.

Is it considered bad practice to combine synchronous and asynchronous socket calls on the same server? For example (modified from the msdn): // Initalize everything up here while (true) { // Set the event to nonsignaled state. allDone.Reset(); //allDone is a manual reset event // Start an asynchronous socket to listen ...

WebException: Unable to connect to the remote server

I have a client application that uses WebHttpRequest to get response from external server, it works fine but some times I'm getting the following exception .... System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: A connection attempt failed because the connected party did ...

socket programming in c++ or VC++.net

Hi, I am a new developer of C++ and i want to do socket programming in c++ or VC++.net. If you have good and easy to learn tutorial for socket programming in c/c++ please share the link. ...

Why do it is required to type cast a pointer?

Hi to C programming expert I am not an expert in C. I am trying to find answer for http://stackoverflow.com/questions/3993762/php-passing-c-struct-data-throught-socket-programming/3996282#3996282 Therefore I am starting a new thread to ask specifically on C language below is the data: typedef struct { UI2 todo; ch...

writing an object to socket

Hi Coders, I have got a problem in here...! I want to write a program in which I have to pass some data and packet_no of that data... So, I am creating an class Packet. I want to send the an Packet object through the OutputStream of the Socket. How do I achieve this? Thanks ...

Apache module in C: how to write data to client socket?

Hello, I have created a simple mod_perl module, which writes a 0-terminated string to the Flash-clients connecting to the port 843. It works ok, but uses 20m per httpd-child at my CentOS 5 Linux machine. So I'm trying to rewrite my module in C, but I'm not sure how to access the client socket through the conn_rec struct that my protoco...

Does NSFileHandle create the sockets for me?

Does NSFileHandle create the sockets for me? Or must I create them myself and then setup an NSFileHandle to use that socket? ...

What's the difference between a "stream-type" socket and a "datagram" socket type?

What's the difference between a "stream-type" socket and a "datagram" socket type? ...

Different server addresses and client address

Server has couple of ip addresses (let say 1 and 2) iface eth0 inet static address 1.1.1.1 netmask 255.255.255.0 addresses-test 1.1.1.2/32 Address 1 is default and all applications use it. How can I change connection address for my applicaton? For example, app1 connects to serverX and serverX see client ad...

C++ Failing at SOCKET accept() Method

Hey guys, I am currently make a Server, I learned to make something like this: while(true) { SOCKET s = accept(s, ....) // do something with the connection printf("connection\n"); } I learned that it will stuck at accept(..) while there isnt a connection. In my Program there isnt any connection yet, but it get overflo...

Debug .NET Socket callbacks

I use the async BeginReceive method of System.Net.Sockets.Socket. This requires a callback to an OnReceive function. However, nothing bugging in this section seems to be taken in charge by the debugger. So if anything goes wrong (uncatched exception), the app just crashes. Any idea how to fix that? ...