Category : "Winsock"

Socket programming with winsock

ICMP ping flood code using sockets in C – Winsock

In a previous article on we saw how to construct raw icmp echo packets and send them out in large quantities to remote hosts in an attempt to bomb them. Now we are going to construct the same program for windows using the winsock socket api. /* Icmp ping flood program in winsock */ #include "stdio.h" #include "winsock2.h" #include "conio.h" #include "stdint.h" #pragma comment(lib,"ws2_32.lib") //winsock 2.2 ...

Code a simple tcp socket server in winsock

Communication over sockets involves 2 programs running on the same machine or on separate machines across a network. First is a socket server and the other is a socket client. Tcp stands for Transmission control protocol and it is the most common protocol being used for most of the network communication that takes place over internet or a lan. There ...

Receive full data with recv socket function in C

recv The recv function is used to receive data on a socket. For example here is the code to fetch the home page of www.msn.com /** Simple TCP client to fetch a web page Silver Moon (m00n.silv3r@gmail.com) */ #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 , server_reply; //Create socket socket_desc = socket(AF_INET , SOCK_STREAM , 0); if (socket_desc == -1) { printf("Could not create socket"); } //ip address of www.msn.com ...

UDP socket programming in winsock

UDP sockets UDP stands for User Datagram Protocol and is an alternative protocol to TCP the most common protocol used for data transfer over the internet. UDP is different from TCP in a number of ways. Most importantly UDP is a connectionless protocol. In the TCP protocol first a connection is established by performing the 3 step handshake. This is done by ...

Winsock tutorial – Socket programming in C on windows

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. For example when you type www.google.com in ...

Get mac address from ip in winsock

Mac address or hardware address is a 48bit (6 character) wide address assigned to a network interface. It is important for the packet delivery between 2 devices like your computer and the router. Ethernet protocol uses the mac address to deliver it to the right network node. It looks like this 00-1E-58-B8-D4-69 ( the dash is not relevant). Mac address ...

TCP Connect Port Scanner Source Code in C with Winsock

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 the connect() function would simply timeout ...

Raw socket programming on windows with Winpcap

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 raw packets on the windows ...

DNS Query Code in C with winsock

DNS Query Its no new fact that when we type a web address in our browser a dns request is immediately send by our browser to a DNS server to get the IP address of that web address.In winsock applications we achieve this by gethostbyname() and things are pretty simple.In this article we shall do this simple thing without the help ...

Packet Sniffer Code in C using Winsock

Winsock packet sniffer A packet sniffer is a program that can sniff the packets moving on the network. All applications communicate over the network with data packets where each packet contains part of the whole data being exchanged. A sniffer is able to pickup these individual packets and read them. In this post we are going to write a very simple packet ...

Pages:12»


Connect with us