I'm trying to do some Socket programming in Java, and I'm using the BufferedStreamReader.read(char[]) method.
the java doc states:
Reads characters into an array. This
method will block until some input is
available, an I/O error occurs, or the
end of the stream is reached.
Only it's not blocking on input.
can somone point ...
I am writing an API which includes IPC functions which send data to another process which may be local or on another host. I'd really like the send function to be as simple as:
int mySendFunc(myDataThing_t* thing, int sd);
without the caller having to know -- in the immediate context of the mySendFunc() call -- whether sd leads to a ...
I am writing somewhat of a proxy program in Java. Here's how it works:
The browser will be connected to the program.
Any requests by the browser will be first be printed out to standard out, then forwarded to the server.
The server then returns a response, which is also printed to standard out, then forwarded back to the browser.
My ...
I'm writing a tcp/ip client and I would need a "test server" to be able to test easily. It should listen on a configurable port, show me when a client connects and what the client sent, allow me to manually enter text to send to the client.
It should work on Windows.
Normally I would have use the simple but powerfull nc.exe (alias "Netc...
How should I check a (TCP) socket to find out whether it is connected?
I have read about the Socket.Connected property in MSDN, but it says it only shows the state according to the last I/O. This isn't useful for me, since I want to do this before trying to read from the socket. The remarks section also notes that:
If you need to de...
Leading on from my previous questions I am going to try and clarify one of the problems I am facing.
I am trying to create a multiplayer version of PacMan.
A simple overview of how i've made my application is that I have a server which has a ServerSocket which is constantly listening on a specific port. Once a client connects it creat...
We've got some old serial code which checks whether a serial port is available simply by opening it and then closing it. Now we are adding network support to the app I want to reuse the function by supplying the ip address as a string.
/**
* So far I have tried:
* A passed in portPath normally looks like:
\\?\acpi#pnp0501#1#1#{GUID} ...
I need to change the order of headers, I'm using this:
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(URL);
request.Method = context.Request.HttpMethod;
request.UserAgent = context.Request.UserAgent;
The output for that is:
GET /* HTTP/1.1
User-Agent: My Server
Host: 127.0.0.1:1080
But it should be
GET /* HTTP/1.1
Host...
Hey guys,
I'm starting to lose my head with this one.
I have a class that extends BaseHTTPRequestHandler. It works fine on
Python 2.5. And yesterday I was curious and decided to install Python
3.0 on my Mac (I followed this tutorial, to be sure I wasn't messing
things up: http://farmdev.com/thoughts/66/python-3-0-on-mac-os-x-alongside-...
Hi
I'm trying to replace this:
void ProcessRequest(object listenerContext)
{
var context = (HttpListenerContext)listenerContext;
Uri URL = new Uri(context.Request.RawUrl);
HttpWebRequest.DefaultWebProxy = null;
HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(URL);
httpWebRequest.Method = context.Re...
I'm working on an instant messenger client in C++ (Win32) and I'm experimenting with different asynchronous socket models. So far I've been using WSAAsyncSelect for receiving notifications via my main window. However, I've been experiencing some unexpected results with Winsock spawning additionally 5-6 threads (in addition to the initial...
Hey guys, question from a C/Networking newbie...
I'm doing some socket programming in C and trying to wrestle with byte order problems. My request (send) is fine but when I receive data my bytes are all out of order. I start with something like this...
char * aResponse= (char *)malloc(512);
int total = recv(sock, aResponse, 511, 0);
...
I have had no trouble getting the sockets working with localips, but once I made the code change to use public ips, I've consistently gotten java.net.ConnectException.
I am using the port 8084, which as far as I know, is not used elsewhere
In the command prompt, netstat -a | grep 8084 shows:
File STDIN:
TCP user-9114eb19a8:8084 ...
I'm looking at the poll() man page, and it tells me the behaviour of poll() when positive and negative values are passed in for the timeout parameter. It doesn't doesn't tell me what happens if timeout is 0. Any ideas?
Looking at the epoll_wait() man page, it tells me that with a timeout value of 0, it will return right away, even if th...
Hello :)
I need to write my own SSL socket (CSocket ansestor) with server side certificate validation using Microsoft CryptoAPI.
Can you tell me which book will help me (or any other user friendly source of information)?
...
Hello,
I'm trying to learn how sockets works in C#. My idea was to program a simple http proxy:
Here's my code:
using System;
using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
class Program
{
static void Main(string[] args)
{
Th...
I am writing a simple proxy in Java. I am having trouble reading the entirety of a given request into a byte array. Specifically, in the following loop, the call to 'read' blocks even though the client has sent all the data that it will (that is, the end of stream is never reached). As I can't be sure that it is time to start writing ...
Does anybody know how to receive (how to know that you received) out-of-band data with Java sockets? In particular I've read the documentation for sendUrgentData and setOOBInline which states that:
Note, only limited support is provided for handling incoming urgent data. In particular, no notification of incoming urgent data is provi...
What is the best way to implement async json socket communication between Flex client and custom server?
Is there a library that can listen to socket and fire event when complete json message/object is raceived?
EDIT: I know that I can use Socket and listen to SOCKET_DATA event, but that triggers event whenever new data is received, wh...
I am trying to access 61616 in my iPhone app and the SCReachability code indicates that I have a valid network, but I time out trying to write to 61616. Does anyone know:
A. If the iPhone EDGE/3G network has a limited port range or isn't allowed to connect to this port?
B. How I can check explicitly for access to this port. Here is my ...