I am teaching myself perl and am writing a socket application to get experience.
I am using Eclipse with the EPIC plugin to run the code in debug mode. I think that sometimes the script is not releasing the port if I terminate it in debug mode as I am occasionally getting the message: -
"bind: Address already in use"
When this happens I have to restart eclipse to clear the port.
I would be grateful if anyone could tell me how to free the port / socket and also if the code example I have built the script around could be strengthened in some way to ensure the socket is freed when the process is terminated.
Hello community,
I'm programming a simple code using socket connection in perl:
$sock = new IO::Socket::INET(
PeerAddr => '192.168.10.7',
PeerPort => 8000,
Proto => 'tcp');
$sock or die "no socket :$!";Then sending data using a loop:
... (1 Reply)
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)
I need clarification on whether it is okay to set socket options on a listening socket
simultaneously when it is being used in an accept() call?
Following is the scenario:-
-- Task 1 - is executing in a loop - polling a listen socket, lets call it 'fd', (whose file descriptor is global)... (2 Replies)
Why does this socket function only read the first 1440 chars of the stream. Why not the whole stream ? I checked it with gdm and valgrind and everything seems correct...
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <string.h>
#include... (3 Replies)
Hi there, Really quick question that I have been unable to find an answer for on the web is simply, can use the newer IO::Socket module on my sever process and use the older perl built-in "socket" module to connect to the IO:socket?
or do i need to have the same module (be it socket or... (1 Reply)
Hey guys, im trying to write a program that'll create a report then email the report... my problem is when it comes to the socket trying to send the second command after EHLO smtp,*.*
When the first command is sent its working fine... but when the program tries to send the second command it... (6 Replies)
Hello there:
What is default value of listen if I, avoid init it on constructor. I need maximum num for Listen. I want to write a daemon thus i need unlimited listen.
my $sock = IO::Socket::INET->new( Listen => 20,
LocalPort => $port,
Reuse => 1)
Thanks in advance. (3 Replies)
Hi,
I was porting ipv4 application to ipv6; i was done with TCP transports. Now i am facing problem with SCTp transport at runtime.
To test SCTP transport I am using following server and client socket programs. Server program runs fine, but client program fails giving Invalid Arguments for... (0 Replies)
Hi all,
I am facing some problem in Socket programming(C++ & Solaris 5.0).I am using socket as
basic connecting point & MEP(Mesagae Exchange Protocol) as high level protocol to send &
receive Message & ACK, between two different system.
MEP is a protocol through which you can send MSG... (0 Replies)
hi
i want to write simple socket program which will listen on socket . here is the code
## read msg on socket
#! /usr/bin/perl
use IO::Socket::INET;
my $MySocket= IO::Socket::INET->new(LocalPort=>1234,
Proto=>'udp') ;
while ()... (2 Replies)