I have small test app:
Socket socket = new Socket("jeck.ru", 80);
PrintWriter pw = new PrintWriter(socket.getOutputStream(), false);
pw.println("GET /ip/ HTTP/1.1");
pw.println("Host: jeck.ru");
pw.println();
pw.flush();
BufferedReader rd = new BufferedReader(new InputStreamReader(socket.getInputStream()));
String str;
while ((str = ...
I'm using fork() on Perl on Windows (ActivePerl) for a basic socket server, but apparently there are problems (it won't accept connections after a few times), is there any workaround?
Here is the portion of the relevant code:
while($client = $bind->accept()) {
$client->autoflush();
if(fork()){ $client->close(); }
else { $bi...
I'm not sure if title sounds right actually, so I will give more explanation here.
I will begin from very beginning :)
I'm using c# and .net for my development.
I have an application that makes requests to some soap web-service and for each user request it produces 3 to 10 requests for web-service, they should all run async to finish...
I have a ethenet access control device that is said to be able to communicate via TCP.
How can i send a pachet by entering the HEX data, since this is what i have from their manual (a standard format for the communication packets sent and received after each command)
Can you please show some example code or links to get started....
s...
From what I read about Java NIO and non-blocking [Server]SocketChannels, it should be possible to write a TCP server that sustains several connections using only one thread - I'd make a Selector that waits for all relevant channels in the server's loop.
Is that right, or am I missing some important detail? What problems can I encounter?...
I have very little experience working with sockets and multithreaded programming so to learn more I decided to see if I could hack together a little python socket server to power a chat room. I ended up getting it working pretty well but then I noticed my server's CPU usage spiked up over 100% when I had it running in the background.
He...
I made an IRC bot which uses a while true loop to receive whatever is said.
To receive I use recv(500), but that stops the loop if there isn't anything to receive, but i need the loop to continue even if there isn't anything to receive.
I need a makeshift timer to continue running.
Example code:
/A lot of stuff/
timer=0
while 1:
ti...
I'm making server that make a tcp socket and work over port range, with each port it will listen on that port for some time, then continue the rest of the code.
like this::
import socket
sck = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sck.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
msg =''
ports = [x for x in xrange...
All the examples I've seen of sock.listen(5) in the python documentation suggest I should set the max backlog number to be 5. This is causing a problem for my app since I'm expecting some very high volume (many concurrent connections). I set it to 200 and haven't seen any problems on my system, but was wondering how high I can set it bef...
I am writing a client for a server that typically sends data as strings in 500 or less bytes. However, the data will occasionally exceed that, and a single set of data could contain 200,000 bytes, for all the client knows (on initialization or significant events). However, I would like to not have to have each client running with a 50 MB...
I have an application processing network communication with blocking calls. Each thread manages a single connection. I've added a timeout on the read and write operation by using select prior to read or write on the socket.
Select is known to be inefficient when dealing with large number of sockets. But is it ok, in term of performance ...
Based on my reading and testing, with asynchronous sockets, the socket itself can be passed using state object (IAsyncResult result), also if store the socket as a private field, it would be captured by the callback methods.
I am wondering how the IAysnResult is kepted between the BeginXXX and ReceiveXXX? It looks to me that after the B...
Hi
The specification of ReadableByteChannel.read() shows -1 as result value for end-of-stream. Moreover it specifies ClosedByInterruptExceptionas possible result if the thread is interrupted.
Now I thought that would be all - and it is most of the time. However, now and then I get the following:
java.io.IOException: Eine vorhandene Ve...
What is the Lua equivalent of Twisted Python, Eventmachine for Ruby, NIO for Java, etc.?
If there is none, how does one do non-blocking event-based network I/O?
In general, how does one solve the C10K problem in Lua?
Thanks!
...
I was just wondering how to send an int from a Java application to a C application using sockets. I have got different C programs communicating with each other and have got the Java application retrieving data from the C application, but I can't work out sending.
The C application is acting as database, the Java application then sends a...
I just want to transfer (send or receive) a hash from client to server.
Can you tell me which is a preferable way in Perl or can you suggest any CPAN modules?
...
is it possible to use raw sockets (on windows) to close a connection between 2 hosts?
if yes then is this the best practice. i am not a cracker, i have a security assignment of 2 phases. phase 1- is to create a sniffer. phase 2- is to create a raw socket and choose a sniffed packet and attack the connection to close it. so how should i d...
I have the following problem. My client program monitor for availability of server in the local network (using Bonjour, but it does not rally mater). As soon as a server is "noticed" by the client application, the client tries to create a socket: Socket(serverIP,serverPort);.
At some point the client can loose the server (Bonjour says t...
I am making simple one on server side & one on client side application for transfering file from one location to another location or from one computer to another computer if computers are in network.
I used the code from http://www.codeproject.com/KB/IP/SocketFileTransfer.aspx. It is working & file transfered successfully.
But i need t...
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <stdio.h>
void error(char *msg)
{
perror(msg);
exit(0);
}
int main(int argc, char *argv[])
{
int sock, length, fromlen, n;
struct sockaddr_in6 server;
struct sockaddr_in6 from;
int portNr = 5555;
char buf[1024];
le...