sockets

Downloading File with libcurl in c++

I am trying to download a zip file from a website but running into a few issues. http://ampaste.net/m1632f19a I implemented libcurl, followed some examples on downloading a file, used a big zip file so I could watch the progress %. It takes about 20 seconds to download, when it completes I go look and there is no file. Anyone have any...

Is it possible to perssist an SMTP connection using PEAR after php finishes it's execution?

As I see, pear only persist the connection during the execution of the script, then it releases... ...

Asynchronous Programming Model when no data is available from a socket

Hi All I want to read from a socket in an asynchronous way. If I used the synchronous code below StreamReader aReadStream = new StreamReader(aStream); String aLine = aReadStream.ReadLine(); // application might hand here with a valid open connection, but no data available for reading, the application would hang at the ReadLine() fu...

Perl IO::Socket timing problem

I've bumped into a strange problem. I wrote a little daemon in Perl which binds a port on a server. On the same server there's a LAMP running and the client for my Perl daemon is a php file that opens a socket with the daemon, pushes some info and then closes the connection. In the Perl daemon I log each connection in a log file for lat...

Is there any difference between IPv4 and IPv6 at the socket level ?

I need to add IPv6 support to an existing socket-based application which currently only supports IPv4. To embrace the incoming era of IPv6, someone ordered me to add an IPv6 interface for the app and let the outside world to choose either the IPv4 interface or the IPv6 interface when trying to communicate with the app. My question is: i...

Posting to internal socket fails when firewall is enabled

I'm working on an application where two processes communicate over loopback interface. Its Linux based system. I'm encountering a very strange problem, when Firewall is enabled, send to internal socket is failing. If I add an iptables rule (in output chain) as shown below from command prompt everything works fine. iptables -I OUTPUT ...

Find original owning process of a Linux socket

In Linux and other UNIX-like operating systems, it is possible for two (or more) processes to share an Internet socket. Assuming there is no parent-child relationship between the processes, is there any way to tell what process originally created a socket? Clarification: I need to determine this from "outside" the processes using the /p...

What does Socket.ReceiveMessageFrom()'s endpoint parameter?

I am writing a proxy application for iSCSI to do some diagnostic work (think Fiddler for iSCSI) - I'm trying to capture data one packet at a time, I don't want to read arbitrary sizes and end up getting all of one iSCSI packet and half of another - I really want to see the same kind of data as Wireshark would display for example. In doin...

Get the client port (in C) after a call to connect

Hello, I am browsing some source code which connects to a remote host on port P(using TCP). After the call to connect,(assuming successful), I would like to discover the client port of the connection (i.e the client port). In truth, I'm browsing the openssh source, in sshconnect.c, there is a function ssh_connect which calls timeout_conn...

Confused about recv()

Pardon if this question has been answered but I couldn't find it. I'm kinda confused about recv() and recvfrom(). Once the server binds the address (or accepts connection for TCP), recv() is called. Does recv() constantly check for messages that has been sent or does it wait until a message is received? If it does wait, how long is the ...

Sockets: large message performance

Hi, I have a doubt regarding the use of Berkeley Sockets under Ubuntu. In terms of performance and reliability which option is best? To send a high amount of messages but with short length or to send a low amount of messages but this ones with a large size? I do not know which is the main design rule I should follow here. Thank you all...

Receiving response(s) from N number of clients in reply to a broadcast request over UDP

Hi All, I am implementing a kind of IP finder for a particular type of network multimedia device. I want to find out all the alive devices of that type in the LAN, with their IP address and other details. The device has its own way of device discovery. It works as follows: A client sends a broadcast request over the LAN via UDP. Th...

Socket connect() always succeeds (TCP over ActiveSync)

I'm using TCP/IP over ActiveSync to connect from Windows CE device to Windows XP desktop. The WinSock connect() function always succeeds, no matter whether desktop server application is actually running. The following simplified code demonstrates this issue: #include "stdafx.h" #include <Winsock2.h> int _tmain(int argc, _TCHAR* argv[]...

Preventing grouping of Python socket.send data from Queue

I am currently making a network layer built that creates binary messages and then sends them to the appropriate network interface (this could be Ethernet, WiFi, Bluetooth, etc). In working on the TCP module, I'm using Python's socket module and everything works great except for when I try to send a series of messages quickly (such as a l...

Connecting to a socket via JavaScript (without flash)

I have a browser based app that needs to communicate with another service running on the client machine via a socket connection from the browser using JavaScript. I need to post and parse XML back and forth on the socket. I am unable to go down the flash path as the cross domain security is a barrier, ie the service running on the sock...

PHP Post data with Fsockopen

I am attempting to post data using fsockopen, and then returning the result. Here is my current code: <?php $data="stuff=hoorah\r\n"; $data=urlencode($data); $fp = fsockopen("www.website.com", 80, $errno, $errstr, 30); if (!$fp) { echo "$errstr ($errno)<br />\n"; } else { $out = "POST /script.php HTTP/1.0\r\n"; $out .= "Hos...

Transferring HashMap between client and server using Sockets (JAVA)

I am working on a JAVA project in which there are multiple terminals. These terminals act as client and servers. For example if there are 3 terminals A,B and C.Then at any given point in time one of them say A, will be a client making broadcast request. The other two terminals, B and C, will reply. I am using sockets to make them communi...

What can cause a connection to APNS to intermittently disconnect?

I've got a ruby script that opens a connection to Apple's push server and sends all the pending notifications. I can't see any reason why, but I get broken pipe errors when Apple disconnects my script. I've written my script to accomodate this happening, but I would rather just find out why it's happening so I can avoid it in the first p...

Using sockets to read from client side

Hi, I basically have a server set up and I'm accepting new clients(UNIX) and i'm using select() command to wait for activity on file descriptor but I'm not sure how to write from the clients side and then read it on the servers side FD_ZERO(&readfds); FD_SET(server_sockfd, &readfds); FD_SET(STDIN_FILENO, &readfds); while (1) { test...

Is there a "Socket Connection Pool" of sorts for Java EE apps?

I'm writing a JAX-RS web service. It responds to client invocations by: Retrieving some info from a database Making a call to an external server For 2) the server does not expose a web service interface (i.e. no WSDL interface or REST API). Instead, it uses a custom protocol over TCPIP. I'd like to make client calls from my JAX-RS re...