Hallo wie sende ich ein IP Packet in C? Mein Compiler ist minGW Gruß

Hallo wie sende ich ein IP Packet in C? Mein Compiler ist minGW Gruß
Hallo!
Na so ähnlich, schau mal in den ersten Link von mir:
main (void)
{
extern void init_sockaddr (struct sockaddr_in *name,
const char *hostname, unsigned short int port);
int sock;
struct sockaddr_in servername;
/* Create the socket. */
sock = socket (PF_INET, SOCK_STREAM, 0);
if (sock {
perror ("socket (client)");
exit (EXIT_FAILURE);
}
/* Connect to the server. */
init_sockaddr (&servername, SERVERHOST, PORT);
if (0 > connect (sock,
(struct sockaddr *) &servername,
sizeof (servername)))
{
perror ("connect (client)");
exit (EXIT_FAILURE);
}
/* Send data to the server. */
write_to_server (sock);
close (sock);
exit (EXIT_SUCCESS);
}
Mein Tipp:
Quäle Dich nicht mit C.
Die Sprache ist S**eisse, unverständlich, kryptisch, hässlich.
Für 90% aller Aufgaben schlicht nicht notwendig.
Nimm Python:
http://docs.python.org/lib/socket-example.html
14 Zeilen Code für einen Echo-Server. 10 Zeilen für den Client.
Und der Code ist lesbar. Und funktioniert. Riesige Bibliothek wird mitgeliefert.
Noch ein bisschen C bashing: http://www.strombergers.com/python/
Gruss
ChrE