Hi,
I'm trying to create a RAW TCP SYN packet and send it from one Linux machine to another. I know the packet I have created is well formed and is received by the peer.
Now what I want is to get an ACK for my SYN. I want the peer's Network protocol stack to send me an ACK for that. I know... (17 Replies)
Hi All,
Not sure if this is the right place to ask, so please tell me where is appropriate...
Anyway, here is the problem. I'm a bit new to kernel programming, so nothing works :confused: . I need to intercept cetrtain ethernet packets from Host1("eth0") to Host2("eth1") and send them to... (1 Reply)
Hi,
I have created a packet socket (PF_PACKET, SOCK_DGRAM, htons(ETH_P_ARP)) to catch the ARP packets coming to my machine and send appropriate reply.
Now I'm able to recieve the ARP requests using recvfrom but don't know how to send the reply. I looked into man page but I'm not able to... (5 Replies)
Hi,
Im doin a project on DHCp client-server setup. i have to use RAW sockets in the code for this. The call PF_PACKET, SOCK_RAW as the first two arguments. The code compiles but when i try to start the Dhcp client, I get an error saying "Make sure CONFIG_PACKET and CONFIG_FILTER is enabled". I... (4 Replies)
Hi There,
Suppoose we have configured logical Interface 2.2.2.2 on a server with Primary IP 1.1.1.1.
Now when I am sending a packet from this server, is it possible to make receiver assume that this packet has come from IP 2.2.2.2 and not 1.1.1.1
I think it is possibl using RAW sockets??? but... (1 Reply)
To create RAW socket in Unix/Linux why should one have root permissions?
Any other work around to create raw sockets in Unix/Linux using a normal login id? Since I don't have super user credentials and I want to create RAW sockets.
Let me know if you are aware of any work around. (3 Replies)
Hi,
I want to write a packet sniffer in C without using libpcap. Can anyone suggest me how to begin writing it? Any tutorials or books?
Thanks in advance! (2 Replies)
Hi everybody!!
I'm studding at the university raw sockets, but i can't find a good place to read about them...
Does anybody now where i can find some information???
I've been goggling a lot but couldn't find nothing useful, just man pages...
by the way, I'm programming under Linux...
Bye! (4 Replies)
Hello
I try to send DHCP RENEW packets to the network and receive the responses. I broadcast the packet and I can see that it's successfully sent using Wireshark. But I have difficulties receiving the responses.I use packet sockets to catch the packets. I can see that there are responses to my... (0 Replies)
Discussion started by: xyzt
0 Replies
LEARN ABOUT DEBIAN
wx::socket
Wx::Socket(3pm) User Contributed Perl Documentation Wx::Socket(3pm)NAME
Wx::Socket - wxSocket* classes
USAGE
use Wx qw(:socket) ;
use Wx::Event qw(EVT_SOCKET_INPUT EVT_SOCKET_LOST) ;
use Wx::Event qw(EVT_SOCKET_CONNECTION) ;
##########
# CLIENT #
##########
my $sock = Wx::SocketClient->new(wxSOCKET_WAITALL);
EVT_SOCKET_INPUT($parent , $sock , &onInput ) ;
EVT_SOCKET_LOST($parent , $sock , &onClose ) ;
$sock->Connect('localhost',5050) ;
if (! $sock->IsConnected ) { print "ERROR
" ;}
sub onInput {
my ( $sock , $this , $evt ) = @_ ;
my $length = 123;
my $buffer ;
$sock->Read($buffer , 1024 , $length ) ;
}
##########
# SERVER #
##########
my $sock = Wx::SocketServer->new('localhost',5050,wxSOCKET_WAITALL);
EVT_SOCKET_CONNECTION($parent , $sock , &onConnect ) ;
if ( !$sock->Ok ) { print "ERROR
" ;}
sub onConnect {
my ( $sock , $this , $evt ) = @_ ;
my $client = $sock->Accept(0) ;
my ($local_host,$local_port) = $client->GetLocal ;
my ($peer_host,$peer_port) = $client->GetPeer ;
$client->Write("This is a data test!
") ;
... or ...
$client->Write( $data , length($data) ) ;
$client->Close ;
}
METHODS
All the methods work as in wxWidgets (see the documentation).
The functions for reading data (Read, ReadMsg, Peek) take 3 arguments, like the Perl read() function:
## To read the data into the variable
$sock->Read($buffer , 1024) ;
... or ...
## To append data at the given offset:
$sock->Read($buffer , 1024 , $offset ) ;
The write functions (Write, WriteMsg, Unread) can be used with 1 or 2 arguments:
$client->Write("This is a data test!
") ;
$client->Write($data , $length) ;
EVENTS
The events are:
EVT_SOCKET
EVT_SOCKET_ALL
EVT_SOCKET_INPUT
EVT_SOCKET_OUTPUT
EVT_SOCKET_CONNECTION
EVT_SOCKET_LOST
The EVT_SOCKET works as in wxWidgets, the others are wxPerl extensions.
Note that EVT_SOCKET events of wxSocketClient and wxSocketServer work differently than other event types.
First you need to set the event handler:
$sock->SetEventHandler($handler, $id) ;
Then you set what types of event you want to receive:
## this select all.
$sock->SetNotify(wxSOCKET_INPUT_FLAG|wxSOCKET_OUTPUT_FLAG|
wxSOCKET_CONNECTION_FLAG|wxSOCKET_LOST_FLAG) ;
Enable the event notification:
$sock->Notify(1) ;
And only after this use:
## note that $handler must be the same that was used in
## SetEventHandler
EVT_SOCKET($handler, $id , sub{...} )
To make the events easier to use, all the proccess is automatic, and you just use:
EVT_SOCKET_INPUT($handler , $socket , sub{...} )
EVT_SOCKET_OUTPUT($handler , $socket , sub{...} )
EVT_SOCKET_CONNECTION($handler , $socket , sub{...} )
EVT_SOCKET_LOST($handler , $socket , sub{...} )
## This is for the events not used yet by the above:
EVT_SOCKET_ALL($parent , $socket , sub{...} )
** The new way is better to handle more than one socket in the same time too.
Take a look in the demos.
SEE ALSO
Wx, The wxWxwindows documentation at <http://www.wxwindows.org/>
AUTHOR
Graciliano M. P. <gm@virtuasites.com.br>
COPYRIGHT
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
perl v5.14.2 2007-06-18 Wx::Socket(3pm)