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 PHP
socket_bind
SOCKET_BIND(3) 1 SOCKET_BIND(3)socket_bind - Binds a name to a socketSYNOPSIS
bool socket_bind (resource $socket, string $address, [int $port])
DESCRIPTION
Binds the name given in $address to the socket described by $socket. This has to be done before a connection is be established using
socket_connect(3) or socket_listen(3).
PARAMETERS
o $socket
- A valid socket resource created with socket_create(3).
o $address
- If the socket is of the AF_INET family, the $address is an IP in dotted-quad notation (e.g. 127.0.0.1). If the socket is of
the AF_UNIX family, the $address is the path of a Unix-domain socket (e.g. /tmp/my.sock).
o $port (Optional)
- The $port parameter is only used when binding an AF_INET socket, and designates the port on which to listen for connections.
RETURN VALUES
Returns TRUE on success or FALSE on failure.
The error code can be retrieved with socket_last_error(3). This code may be passed to socket_strerror(3) to get a textual explanation of
the error.
EXAMPLES
Example #1
Using socket_bind(3) to set the source address
<?php
// Create a new socket
$sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
// An example list of IP addresses owned by the computer
$sourceips['kevin'] = '127.0.0.1';
$sourceips['madcoder'] = '127.0.0.2';
// Bind the source address
socket_bind($sock, $sourceips['madcoder']);
// Connect to destination address
socket_connect($sock, '127.0.0.1', 80);
// Write
$request = 'GET / HTTP/1.1' . "
" .
'Host: example.com' . "
";
socket_write($sock, $request);
// Close
socket_close($sock);
?>
NOTES
Note
This function must be used on the socket before socket_connect(3).
Note
Windows 9x/ME compatibility note: socket_last_error(3) may return an invalid error code if trying to bind the socket to a wrong
address that does not belong to your machine.
SEE ALSO socket_connect(3), socket_listen(3), socket_create(3), socket_last_error(3), socket_strerror(3).
PHP Documentation Group SOCKET_BIND(3)