Using Connect and Bind on a Raw socket

Bind and connect API can be used on a RAW socket connection. However, it is normally not performed. The below snippets from the book “Unix Network Programming” describes the bind and connect operation as below: “bind can be called on the RAW socket, but this is rare. This function sets only the local address: There […]

Analysis of RAW socket IPPROTO_UDP code

The Raw socket code based on UDP protocol can be seen at this Link. We directly send the packet to the destination address via “sendto” API. As was seen in the TCP code for Raw sockets, we need to create the UDP header in the application and send the header alongwith the packet data. The […]

Analyzing TCP/UDP/IP headers for Raw Sockets

In this article, we look at certain aspects of TCP/UDP/IP headers which we would most likely be used in the coming example implementations for Raw socket for TCP/UDP protocols in this website.  Kindly note that this article does not try to explain the TCP/UDP/IP headers in detail, but only tries to provide context to the […]

Raw sockets – an Introduction

Normally the TCP/UDP sockets provide an abstraction wherein the user of those sockets does not need to concern himself/herself with the TCP/IP or layer 2 headers. The data is provided to the socket with all the lower layer headers removed. But what if some one wished to tweak the IP headers themselves. If a developer […]

Sequenced Socket Packet code example

Linux supports the SOCK_SEQPACKET socket connection for AF_UNIX domain. The Sequenced socket SOCK_SEQPACKET code is exactly similar to AF_UNIX TCP stream socket code.  The only difference is that the “type parameter” of the socket API is passed SOCK_SEQPACKET as the type. The code analysis for the TCP Stream socket can be seen at this link […]