• Jetzt anmelden. Es dauert nur 2 Minuten und ist kostenlos!

Problemm Mit Sockets

Tomhalo

Neues Mitglied
Code:
[SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]// Socket.cpp : Definiert den Einstiegspunkt fr die Konsolenanwendung.
//
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]#include[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"stdafx.h"
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]#include[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"string"
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]#include[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"iostream"
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]/* Windows-System */
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]#ifdef[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] _WIN32
[/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]#include[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]<winsock.h>
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]/* Unix-System */
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]#else
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#808080][SIZE=2][COLOR=#808080]#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <unistd.h>
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]#endif
using[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]namespace[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] std;
[/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]int[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] _tmain([/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]int[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] argc, _TCHAR* argv[])
{
[/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]int[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] sockfd = socket (AF_INET, SOCK_STREAM, 0);
[/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]if[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] (sockfd == -1)
{
cout<<[/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"es konnte kein Socket Bereitgestellt werden"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]<<endl;
}
system([/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"pause"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]);
[/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]return[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] 0;
}
[/SIZE]

Ihrgendwie coompilt mein ide Visual C++ 2008 das nicht kann mir bitte wer sagen wo der fehler ist ich versuche mcih zum erstenmal mit sockets

Code:
[SIZE=1]------ Erstellen gestartet: Projekt: Socket, Konfiguration: Debug Win32 ------
Kompilieren...
Socket.cpp
Verknpfen...
Socket.obj : error LNK2001: Nicht aufgelstes externes Symbol "_socket@12".
C:\Dokumente und Einstellungen\TomHalo\Eigene Dateien\Visual Studio 2008\Projects\Socket\Debug\Socket.exe : fatal error LNK1120: 1 nicht aufgelste externe Verweise.
Das Buildprotokoll wurde unter "file://c:\Dokumente und Einstellungen\TomHalo\Eigene Dateien\Visual Studio 2008\Projects\Socket\Socket\Debug\BuildLog.htm" gespeichert.
Socket - 2 Fehler, 0 Warnung(en)
========== Erstellen: 0 erfolgreich, Fehler bei 1, 0 aktuell, 0 bersprungen ==========
[/SIZE]

Dies gibt mein Compiler aus
 
Werbung:
Zurück
Oben