Category Archives: Winsock

Socket programming with winsock

Receive full data with recv socket function in C

By | August 6, 2016

recv The recv function is used to receive data on a socket. For example here is the code to fetch the home page of /** Simple TCP client to fetch a web page */ #include<stdio.h> #include<string.h> //strlen #include<sys/socket.h> #include<arpa/inet.h> //inet_addr int main(int argc , char *argv[]) { int socket_desc; struct sockaddr_in server; char *message… Read More »

Winsock tutorial – Socket programming in C on windows

By | April 23, 2019

Socket programming with winsock This is a quick guide/tutorial to learning socket programming in C language on Windows. “Windows” because the code snippets shown over here will work only on Windows. The windows api to socket programming is called winsock. Sockets are the fundamental “things” behind any kind of network communications done by your computer…. Read More »

TCP Connect Port Scanner Source Code in C with Winsock

By | November 27, 2012

Tcp connect port scanning TCP connect() scanning is the most basic form of TCP scanning. The program performs a connect() command on those ports of the target machine which are to be checked. If the port is open then the connect() command will succeed and a connection will be established. If the port is closed… Read More »

Raw socket programming on windows with Winpcap

By | November 27, 2012

Raw sockets with winpcap A previous post explains how to send on windows xp. However the winsock api has limited raw socket support in windows versions greater than windows xp+sp1. Therefore winpcap has to be used to send raw packets on higher windows versions. Winpcap is a packet driver useful for packet capturing and sending… Read More »