D
aloa paranoiac
deine version hat bei mir auch fehler verursacht (BCB 6)
folgender code compiliert jedoch anstandslos:
//---------------------------------------------------------------------------
// includes
#include <winsock2.h>
#include <windows.h>
//#include <ws2tcpip.h>
#include <stdio.h>
#pragma hdrstop
#pragma argsused
// header
typedef struct iphdr{
unsigned char h_lenver;
unsigned char tos;
unsigned short total_len;
unsigned short ident;
unsigned short frag_and_flags;
unsigned char ttl;
unsigned char proto;
unsigned short checksum;
unsigned int sourceIP;
unsigned int destIP;
}IPHDR;
typedef struct tcpheader{
unsigned short int sport;
unsigned short int dport;
unsigned int th_seq;
unsigned int th_ack;
unsigned char th_x2:4;
unsigned char th_off:4;
unsigned char Flags;
unsigned short int th_win;
unsigned short int th_sum;
unsigned short int th_urp;
}TCPHDR;
// main
int main()
{
int s, bytes;
char buffer[1024], *data;
WSADATA wsa;
WSAStartup(MAKEWORD(1, 1), &wsa);
s = socket(AF_INET, SOCK_RAW, IPPROTO_TCP);
if (s == -1)
{
perror("socket() failed");
return 1;
}
while( (bytes = recv(s, buffer, sizeof(buffer), 0)) > 0) {
data = buffer + sizeof(IPHDR) + sizeof(TCPHDR);
buffer[bytes] = '\0';
printf("%s", data);
fflush(stdout);
}
// quit
return 0;
}
hoffe es hilft dir
Deadman