I'm updating legacy code, written in VB6, and I've come across the need for a mutex. I have two sockets, and I need to send and receive from various sources. So I plan on having one socket continuously listening for incoming connections, then the other is used to send or receive.
A timer checks twenty times a second if a connection has ...
I have tracked down a deadlock in some code of mine using this reproducer:
if( isClient )
{
Sender sender;
Receiver receiver;
ConnectionPtr connection = Connection::create( description );
TEST( connection->connect( ));
receiver.start();
Sleep( 100 );
sender.start();
sender.join();
}
else
{
Connectio...
Hello,
I'm using FriendlyARM with linux 2.6.29 and compiling with ARM-Linux GCC
4.3.2
When trying to open a socket with PF_PACKET it fails with errno 97, Address
family not supported by protocol.
This is an example program that illustrates the problem -
#include <stdio.h>
#include <sys/socket.h>
#include <netpacket/packet.h>
#in...
I am having a weird concurrency issue with Python on Cygwin. I am running two threads:
A thread which sends UDP packets at regular intervals
A main thread which waits for KeyBoardInterrupt and when it receives one, it tells the UDP thread to stop sending via a boolean flag
This works just fine under Linux (python 2.6) and Windows (Py...
I'm currently rewriting some existing technologies that were once using RSA Security's libraries into OpenSSL, but I'm starting to run into a few issues. Currently, all of the certificate verification code appears to be running without a hitch, until that is, I call SSL_connect().
Before, the call to SSL_connect() would produce SSL_ERR...
My program uses a NetworkOutput object which can be used to write data to a remote server. The semantic is that in case the object is currently connected (because there is a remote server), then the data is actually sent over the socket. Otherwise, it's silently discarded. Some code sketch:
class NetworkOutput
{
public:
/* Constructs ...
Hi,
I'm developping a streaming application with tcl.
I have a vlc sever that broadcast a flow in http mode. what I'm trying to do is to develop a client who will try to connect to server with a particular ip adress and port number, and then try to save the flow in a file.
the code that i'm using is simple:
set server localhost
set sock...
I have a receive callback from an async client method that is supposed to call socket.BeginReceive internally to check if data is done being sent. The code is as follows:
private void ReceiveCallback(IAsyncResult ar)
{
try
{
StateObject state = (StateObject)ar.AsyncState;
Socket client = s...
I'm making a web services call to a Microsoft CRM web service using Python/suds/python-ntlm, and my call to the service is blocking on an SSL read. The CRM service provider provides both a testing and a production service, and I can contact the testing service just fine (although it doesn't have useful data on it) but the main service ju...
I'm implementing a server passing socket descriptors to worker processes for handling. It send them via UNIX sockets using the sendmsg system call. Server itself can listen on a UNIX socket or an INET socket. I have a problem putting it behind nginx. When my server runs on a INET socket, everything is OK. But proxing doesn't work through...
Hi,
I'm working on a project where I want to post a wall message to the users Facebook page but the problem is that the program will run on a very limited system and the only way I have to talk with Facebook is via sockets in C/C++.
Anyone have any code examples of how to do this?
Asking for the username/password is no problem so I will...
Hello,
I'm having problems with sockets in java. I have a ServerSocket that is listening with accept() and spawns threads for each client-request. Communication between clients and the server works fine. I am using an inputstream to read data from clients in the serverthreads, like:
inputStream = mySocket.getInputStream();
bytes = inpu...
I'm requesting a webpage with sockets like this:
Socket sock = null;
PrintWriter out = null;
BufferedReader in = null;
try {
sock = new Socket( "www.overvprojects.nl", 80 );
out = new PrintWriter( sock.getOutputStream(), true );
in = new BufferedReader( new InputStreamReader( sock.getInputStream() ) );
} catch ( UnknownHost...
Lately, I've been working on some small data serialization demos. However, I was wondering how to transfer binary data from a structure into a file descriptor.
I am aware that the only (simple) way to do this is through fwrite (if write does this, then please say so), so is there either:
A) An fwrite call to use on file descriptors?
o...
Hi everyone,
I want to do an application that sends data to specified ip range.However,i faced a problem like this.When i put fsockopen function in a loop the code returns nothing and the page(browser page) is alwalys loading mode.When i do a single fsockopen to google it works but when i do it in a loop it doesnt...
Thanks for advance.....
Hey everyone,
I am using this code to receive data from a UDP socket and return it as string:
byte[] receiveData = new byte[MAX_PACKET_SIZE];
DatagramPacket receivedPacket = new DatagramPacket(receiveData, receiveData.length);
serverSocket.receive(receivedPacket);
return new String(receivedPacket.getData(), 0, receivedPacket.getLength(...
I have to fetch content of some urls by using proxies from a list.
All proxies requires authentication (i have username and passwords as well).
Problem is i don't have curl installed on server , so can't use curl.
I tried using sockets but having problem using that.
Any help is appreciated .
...
I remember having read somewhere that a socket can be regarded as two independent half-duplex channels. Does it mean that recv() and send() of the same socket are actually irrelevant?
if so, is it by definition or
implementation-specific?
if not, how the two interfere with each other?
thanks.
...
Hi, I have the following PHP code for writing to a filepointer $fp that was opened using fsockopen:
syslog(LOG_INFO, "Write " . strlen($buf) . " bytes to socket:");
$bytes = 0;
while ($bytes < strlen($buf) && ($w = @fwrite($fp, substr($buf, $bytes))))
{
syslog(LOG_INFO, " - " . $w . " bytes written to socket");
$bytes += $w;
}...
I wrote a Proxy in C# using sockets and a TCPListener listening to a particular port. Currently the listener gets the "GET" request from the clients browser, and then uses the Socket.Send() class to forward the request on behalf of of the client. The response is recieved using the Socket.Reveive() class and then forwarded onto the client...