I've been experimenting with many TCP Socket projects found on the Internet. The 'Server' class will often accept 'multiple clients', but only one connection at a time due to 'Single Port' usage restrictions. I've discovered Winsock responds differently on Visa than XP. The Visa Winsock will redirect the same incoming port to a random, u...
I'm writing a basic html-proxy in python (3), and up to now I'm not using prebuild classes like http.server.
I'm just starting a socket which accepts connection:
self.listen_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.listen_socket.bind((socket.gethostname(), 4321))
self.listen_socket.listen(5)
(a, b) = self.listen_...
I've been reading the man page for read(2) and according to the man page, the return value of read(2) is -1 on error, 0 on EOF, and > 0 for the number of bytes read.
How do I tell when the write(2) on the client is finished ?
I ask because I'm writing a server and a client to test it, but when I read(2) the first time and loop arou...
Here's the thing. I need a daemon running on the server which basically will open an smtp connection, then it will expect calls to the process to send e-mails through the opened connection.
This is to avoid connecting to the smtp every time, instead I can receive multiple calls to the process but connection only one time.
By the way, t...
Hello, everyone!
What is the common way in Java to validate and convert a string of the form host:port into an instance of InetSocketAddress?
It would be nice if following criteria were met:
No address lookups;
Working for IPv4, IPv6, and "string" hostnames;
(For IPv4 it's ip:port, for IPv6 it's [ip]:port, right? Is there some RFC wh...
Hi I am facing a problem.
I want to detect whether socket connection with a particular ip address is already established in the system. In linux there are 4 desktops so if tcp socket connection is already established in 2nd desktop and I want to re-establish in third desktop or if I want to re-establish another connection using anoth...
Hi,
I'm working on a client-server application written in C,
I want to broadcast a message to all the machines available in the network.
How can I do that using the usual socket system calls in C ?
Thank you!
...
Hi,
My code was working absolutely fine before the launch of iPhone SDK 3.0 , I am using socket functions to send data and receive data. What changes must i make to make it compatible for 3.0+.
-(int)InitSocket:(int)nPort: (NSString*)sServer{
if(sServer == nil)
{
return -1;
}
m_nPort = nPort;
sServerAddress = sServer;
const char...
Hello,
I'm programming a C/C++ client/server sockets application. At this point, the client connects itselfs to the server every 50ms and sends a message.
Everything seems to works, but the data flow is not continuous: Suddenly, the server doesn't receives anything more, and then 5 messages at once... And sometimes everything works...
...
I want to measure message latency and throughput for both TCP and UDP using C sockets. I am writing a client.c and server.c (Question 1: Do I have to?) that run on different servers to accomplish this. I have to take several measurements using different packet sizes and multiple trials and plot my results.
For message latency:
Send a pa...
I'm not able to connect a simple client and a simple server. When I run the server there doesn't seem to be any problem, but when I try to send it data with the client it throws an exception saying that it didn't connect within a timeout period.
Here is the server code I'm using:
public void server()
{
try
{
...
Hi,
What could be the maximum number of concurrent Clients(using different port number) that could communicate to a Server on the same port (Single socket) ? What are the factors that could influence this count ? I am looking for this information w.r.t telnet in linux environment.
Thx in advans,
Karthik Balaguru
...
I'm still a neophyte Python programmer and I'm trying to do something that is a bit over my head.
What I've done is create a simple IRC bot using asyncore (and asynchronous sockets module). The client runs in a continuous loop, listening to the conversation in the channel. What I would like to do (I think?) is implement an observer pa...
I'm working with socket in python, and being in development stage I need to kill and restart my program frequently.
The issue is that once killed my python script, I've to wait long time to be able to rebind the listen socket. Here's a snippet to reproduce the problem:
#!/usr/bin/env python3 ...
I need to connect to a remote server whose remote name and PORT number is specified to me. This I need to do over Unix sockets. After connecting with it, I will need to receive the messages the server sends and then send it data as it instructs me to do. I know the steps to make this client program but i'm lost as to the exact things I n...
EDIT: the code below has been fixed to receive and send properly AND to account for the actual bytes of messages sent annd recieved (latter thanks to EJP)
Hey guys, I'm programming in C, Unix.
I have server and client that are supposed to exchange msgs. While client seems to send messages fine, server doesn't receive the messages the c...
Speed, optimization, and scalability are the typical comparisons between the Udp and Tcp protocols. Tcp touts reliability with the disadvantage of a little extra overhead, but speed is good to excellent. Once a Tcp socket is instanced, keeping the socket open requires some overhead. But compared to the oft described burdens of Udp, which...
I'm using both Linux and Win32 socket APIs. In my program, multiple threads share a socket handle. In particular, multiple threads call send with the shared socket handle (i.e., the same port). In this case, do I have to put a lock for thread safety? I was unable to find the answer. I may do a test, but want to hear your experiences.
ED...
Hi!
I am running a function: @socket_recvfrom($this->socket, $buf, 8192, 0, $from, $port);
but this returns an error saying:
socket_recvfrom(): unable to recvfrom [0]: The operation completed successfully.
Anyone who has an idèa about this? What does this mean?
OS: Windows
PHP: 5.3
Morten
...
Hello,All
im totally new to socket programming in python. i was read some tutorial and manual, but i didn't found what i want to make python related socket script in manual or tutorial.
i want to make socket script which can send some info to server and also receive some info from server. For example, i want to send my login informatio...