Autor Beitrag
hallo
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 450

WIN XP, SuSE 9.3
D3 Prof, D6 Pers, 2005 Pers
BeitragVerfasst: Do 22.07.04 13:52 
Hi,

da ich eine Verbindung mit dem Clientsocket und Serversocket über das Netzwerk/Internet herstelle, muss ich wissen ob der Port noch frei ist. Wenn er nämlich nicht mehr frei ist, und ich Aktiviere den Serversocket, dann sagt Windoof XP, dass das Programm beendet werden muss!

_________________
Der beste je Programmierte Trojaner: Windows XP
Wäre es nicht adequat, den Usus heterogener Termini zu minimieren?
maxk
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1696
Erhaltene Danke: 1

Win XP, Debian Lenny
Delphi 6 Personal
BeitragVerfasst: Do 22.07.04 13:58 
Hier ist ein Copy&Paste-Schnipsel:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
uses WinSocks;

var ASocket:integer;
    SocketAddr:SOCKADDR_IN;
begin
 Result:=False;
 ASocket:=Socket(AF_INET,SOCK_STREAM,0);
 if ASocket=INVALID_SOCKET then begin
  ShowMessage('Fehler beim Prüfen von: '+IntToStr(Port)+#13+
   'Socket konnte nicht erstellt werden');
  exit;
 end;
 ZeroMemory(@SocketAddr,SizeOf(SOCKADDR_IN));
 SocketAddr.sin_Family:= AF_INET;
 SocketAddr.sin_Addr.S_Addr:=ntohl(IP);
 SocketAddr.sin_Port:=htons(Port);
 Result:=Connect(ASocket,SocketAddr,SizeOf(SocketAddr))<>SOCKET_ERROR;
 CloseSocket(ASocket);

_________________
Ein Computer wird das tun, was Du programmierst - nicht das, was Du willst.
hallo Threadstarter
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 450

WIN XP, SuSE 9.3
D3 Prof, D6 Pers, 2005 Pers
BeitragVerfasst: Do 22.07.04 18:14 
Bei mir gibts die Winsocks irgendwie nicht.
Hab Delphi 6
Ich probier jetzt mal grad was andreres...

:motz: :motz: :motz: Jetzt hab ich es mit try und except versucht, und jetzt funktioniert es erst einmal! Und ich hab die ganze Zeit nicht daran gedacht!!! :motz: :motz: :motz:

_________________
Der beste je Programmierte Trojaner: Windows XP
Wäre es nicht adequat, den Usus heterogener Termini zu minimieren?
maxk
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1696
Erhaltene Danke: 1

Win XP, Debian Lenny
Delphi 6 Personal
BeitragVerfasst: Do 22.07.04 19:05 
Tja, wie soll ich sagen... Die heißen ja auch WinSock...

_________________
Ein Computer wird das tun, was Du programmierst - nicht das, was Du willst.