i want to write simple socket program which will listen on socket . here is the code
now i want is that receiver program should try to read on port for 10 sec if no msg is received then wait for minute and again check for message for 10 sec do this for 10 minutes ( inshort check if any message is received in 10 minutes )
but code waits at
line for mesg till it receives msg. Timeout => 10 is not working
what else i can do ? any other module ?? or any work around ??
Suppose i am writing a C program which is going to use Socket calls. I want to use a Unix port for my Socket.
How can i determine a port which is not already in use? (1 Reply)
Hello,
I actually try to make client-server program.
I'm using SCO OpenServer Release 5.0.0 and when I try to compile my code (by TELNET) I've got this error :
I'm just using this simple code :
and I get the same error if I use :
If someone can help me,
Thanks (2 Replies)
Can anyone plz me. I need a sample code for the following description.
Its urgent.
It is C/Socket program with the following descriptions:
NAME
coreadServer - Concurrent Readers Server.
coreadClient - Concurrent Readers Client.
SYNOPSIS
coreadServer <OutputFile>
coreadClient <n>... (1 Reply)
i m using sockets for setting up a connection between a server and a client.
When the clients gets connected to the server, its ip is conveyed to the server through one of the predefined structures in c library...
i save this ip address in an array....1st client's ip address goes to the zeroth... (1 Reply)
Hi,
I am trying to connect to more than 60 servers to perform some actions remotely. for this I am using ssh2. But its taking lot of time.
Though i am running the command in background, still its taking long time to execute..
Any one let me know can we use sockets instead of ssh2 for... (3 Replies)
hi guys i got this code trying to make connection between the server and multi clients but when i do ./server i got message server waiting then when i run ./client it says client 1 nosuch file i dont know whats that should i use any argument plz help how to compile and run and whats the expected... (1 Reply)
in socket programming how can i : Create for example 3 blank files, namely: server, client, network
•Server: act as servers/provider, will receive all requests from different client
•Client: requesters
•Network: middle-layer of communication between server & client
any tips or... (6 Replies)
i'm doing a simple program in socket programming on c i have server that can handle 2clients in a single machine i'm running ubuntu linux so i got it work but the probelm when clients send a message the server will echo it but i cant distinguish which client send the message client 1 or client... (7 Replies)
Hi All
I am getting an error when using the below code
Receiver
use IO::Socket;
$sock = new IO::Socket::INET (LocalHost => 'goldengate',
LocalPort => 1200,
Proto => 'tcp',
Listen => 5,
Reuse => 1
);
die "Socket could not be created. Reason: $!" unless $sock;
while ($new_sock =... (5 Replies)
Discussion started by: parthmittal2007
5 Replies
LEARN ABOUT PHP
socket_last_error
SOCKET_LAST_ERROR(3) 1 SOCKET_LAST_ERROR(3)socket_last_error - Returns the last error on the socketSYNOPSIS
int socket_last_error ([resource $socket])
DESCRIPTION
If a socket resource is passed to this function, the last error which occurred on this particular socket is returned. If the socket
resource is omitted, the error code of the last failed socket function is returned. The latter is particularly helpful for functions like
socket_create(3) which don't return a socket on failure and socket_select(3) which can fail for reasons not directly tied to a particular
socket. The error code is suitable to be fed to socket_strerror(3) which returns a string describing the given error code.
PARAMETERS
o $socket
- A valid socket resource created with socket_create(3).
RETURN VALUES
This function returns a socket error code.
EXAMPLES
Example #1
socket_last_error(3) example
<?php
$socket = @socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
if ($socket === false) {
$errorcode = socket_last_error();
$errormsg = socket_strerror($errorcode);
die("Couldn't create socket: [$errorcode] $errormsg");
}
?>
NOTES
Note
socket_last_error(3) does not clear the error code, use socket_clear_error(3) for this purpose.
PHP Documentation Group SOCKET_LAST_ERROR(3)