sockets

Whats the best Http Component which supports SOCKS and HTTPS for C#.NET

Hi , Iam coding an application which needs to do some web automation to some websites from our intranet. Some are simple web services while some will be https websites. My application needs to connect to them via socks proxies. Now httpwebrequest class does not support socks so Iam looking to code a complete HTTP wrapper using Sockets...

Has anyone used SecureBlackBox?

Hi All, Has anyone used SecureBlackBox? It is a library that can be used with sockets to encrypt the data sent over the socket. I have a project that uses it, and to send a packet of data which is around about 976Kb using the SecureBlackBox library it takes 12 seconds. If I strip out the library and just use normal sockets it takes fr...

Android ServerSocket ports, connection timeout problem

Hello, I am playing around a bit with peer-to-peer communication with android devices. I have written a basic program that creates a listening ServerSocket on each phone using the application. Using the application you can also connect to other devices that is listening, by connecting to the remote ServerSocket. Nothing strange about t...

connecting two android devices via TCP sockets

Hi! I've been trying to connect two Android devices (2.1) via TCP sockets. The vital part of the code: Server: ServerSocket serverSocket = new ServerSocket(SERVERPORT); Client: Socket socket = new Socket(serverAddr, SERVERPORT); The weird thing is I can make it work if the client is an emulator, but the same code fails if running bot...

Unexplained SocketException in Java client connecting to localhost

Hi, I have a Java program running on an iSeries which connects to a server process on the same host. Here's an edited version of the Java client code: while (true) { try { socket = new Socket(myHost, myPort); } catch (UnknownHostException ex) { // Quit } catch (ConnectException ex) { // Wait for a while and retry co...

Asynchronous approach to using streams with sockets

I've always built my own serializers/deserializers to be able to use BeginReceive/EndReceive with sockets to avoid using one thread per connected socket. It's a quite time consuming task. I've started to look at protobuf-net and want to used it with async sockets without having to write serialization/deserialization myself. I would pref...

How do I properly simulate high latency on a C# socket server test?

I have a class that uses 'System.Net.Sockets.Socket' directly for network comunication, and currently I use the following two interfaces to break dependency on the Socket class : public interface ISocketListener { void Listen(int backlog); ISocket Accept(); void Bind(EndPoint endpoint); }...

grep: operation not supported on socket

I get this error on cygwin 1.7.5-1 under zsh and rxvt when I try to run grep "getDirectories" * It seems to happen once per directory. I successfully ran this operation many times under cygwin 1.7.1 just a few days ago before I had to get a new laptop. Anyone know what is causing this error? ...

Socket in python will only send data it receives

I must be missing something in the code. I've rewritten an 'echo server' example to do a bit more when it receives something. This is how it currently looks: #!/usr/bin/env python import select import socket import sys import threading import time import Queue globuser = {} queue = Queue.Queue() class Server: def __init__(self)...

Writing C# equivalent of perl code to send and receive through UDP socket?

I want to write code in C# similar to following code in perl. What the code does is sends a message through UDP socket and requests for a TCP Port. The code in perl is as below: # Get a UDP connection to port $proto = getprotobyname('udp'); no strict 'refs'; $udpS = "UDP Socket"; if ( !socket($udpS, AF_INET, SOCK_DGRAM, $proto)...

fsockopen not working?

I am trying to connect to an IRC server via PHP on a command line using Windows 7. Everytime when running this: $socket = fsockopen($irc_server, 6667, $errno, $errstr, 5); $errno = 0, $errstr = "" and $socket = 'Resource id #4' (using die($socket);) What is the cause of this, and how can I debug more into this. The following code: ...

(How) Can I find the socket type from the socket descriptor?

I am writing a program to capture socket network flow to display network activity. For this, I was wondering if there is any way I can determine the socket type from the socket descriptor. I know that I can find socket family using getsockname but I could not find a way to find socket type. For instance, I want to find if this socket w...

Two threads using the same variable, produces a problem.

I have a List and two threads that using the List. The first thread is getting new connections, each new connection is added to the List. The second thread looping over the List to handle the connections (using foreach). The problem is that sometimes while the second thread is looping over the List, the List changes before the loop en...

Difference between LoopingCall and callInThread in Python's Twisted.

I'm trying to figure out the differences between a task.LoopingCall and a reactor.callInThread in Twisted. All my self.sendLine's in the LoopingCall are performed immediately. The ones in the callInThread are not. They're only sent after the one in the LoopingCall has finished. Even though I'm sending the right delimiter. Why is that? ...

Socket.BeginRecieve is never re-called in the callback function

Hey all! I'm pretty fresh in the game of C# and .NET so I found some exercises on the net. More specifically an asynchronous web server. I'm currently having some problems with getting the callbacks to fire. Socket.BeginReceive fires its callback the first time, but when I try to do it recursively (like shown on MSDN Tutorial - to get a...

iPhone Basic Drawing + Socket communication

I took upon myself to create an App that allows the user to draw and as he draws the strokes would be sent to a server via a Socket connection. The app also needs to receive strokes and display them as well. This would be just a demo app for our server, not a serious iPhone app. Any ideas, suggestions would be AWESOME. I started with ...

Unknown Java UDP socket error

I get that exception bellow once in a minute or so. I was getting it very frequently before, but when I changed the parameter in linux allowing more connections this error appears less frequently but is constantly appearing. App is distributed in nature, and makes large number of connections. IOException (udp) with (some real IP address...

Android HttpClient versus plain Socket ?

I'm currently involved in an android application whose basic purpose is to upload large media files. What is difference of using HttpClient for uploading large files over using plain sockets in Android ? From what I had researched I found out that in order to send large files to server I need to use 'multipart POST' but it seems it is po...

Is Ruby on Windows failing when dealing with IPv6?

So I've got a tool that I built in Ruby that uses net/http to make some requests to an external REST service. I built and unit tested this tool using Windows 7 and it worked absolutely fine. Now, since this tool is meant to be run periodically on one of our servers (running Windows Server 2008 R2), I deployed it there and suddenly it's ...

What is the meaning of SO_REUSEADDR (setsockopt option) - Linux?

From Linux man page: SO_REUSEADDR Specifies that the rules used in validating addresses supplied to bind() should allow reuse of local addresses, if this is supported by the protocol. This option takes an int value. This is a Boolean option When should I use it? Why does "reuse of local addresses" give? Thanks, Ray ...