![]() |
Suche WSocket unit für D2010 (Unicode)
Hallo zusammen,
wir verwenden in alten D7-Projekten die Unit WSockets.pas von Robert T. Palmqvist:
Delphi-Quellcode:
Nun möchten wir die Projekte auf Delphi 2010 (Unicode) umstellen und ich bin auf der Suche nach einer neuen Version der Unit. Weiß jemand, ob es eine neue Version gibt?
unit WSockets;
{ WSockets Version 1.20 - A Simple VCL Encapsulation of the WinSocket API VCL Classes in this Unit: TTCPClient - A TCP Client (derived from TCustomWSocket) TTCPServer - A TCP Server (derived from TCustomWSocket) TUDPClient - A UDP Client (derived from TCustomWSocket) TUDPServer - A UDP Server (derived from TCustomWSocket) Other classes ni this Unit: TCustomWSocket - A generic base class for other socket classes TClientList - A list class used only by the TTCPServer class Legal issues: Copyright (C) 1997 by Robert T. Palmqvist <robert.palmqvist@skanska.se> ... Danke, Christoph |
AW: Suche WSocket unit für D2010 (Unicode)
..magst Du wsockets.pas nicht selber anpassen.
Im ersten Ansatz string durch ansiString ersetzen. Welche Fehler bekommst Du denn, wenn Du die Unit benutzt? Grüße Klaus |
AW: Suche WSocket unit für D2010 (Unicode)
Zitat:
Zitat:
bei ->:
Delphi-Quellcode:
Gruß, Christoph
function TCustomWSocket.GetLocalHostAddress: string;
var SockAddrIn: TSockAddrIn; HostEnt: PHostEnt; szHostName: array[0..128] of AnsiChar; begin -> if gethostname(szHostName, 128) = 0 then begin HostEnt := gethostbyname(szHostName); if HostEnt = nil then Result := '' else begin SockAddrIn.sin_addr.S_addr := longint(plongint(HostEnt^.h_addr_list^)^); Result := inet_ntoa(SockAddrIn.sin_addr); end; end else SocketError(WSAGetLastError); end; |
AW: Suche WSocket unit für D2010 (Unicode)
und wenn du es so schreibst?
Delphi-Quellcode:
Grüße
if gethostname(szHostName[0], 128) = 0 then
begin Klaus |
AW: Suche WSocket unit für D2010 (Unicode)
Jetzt habe ich es:
Delphi-Quellcode:
function TCustomWSocket.GetLocalHostAddress: string;
var SockAddrIn: TSockAddrIn; HostEnt: PHostEnt; szHostName: array[0..128] of AnsiChar; begin if gethostname(szHostName, SizeOf(szHostName)) = 0 then begin HostEnt := gethostbyname(szHostName); if HostEnt = nil then Result := '' else begin SockAddrIn.sin_addr.S_addr := longint(plongint(HostEnt^.h_addr_list^)^); Result := inet_ntoa(SockAddrIn.sin_addr); end; end else SocketError(WSAGetLastError); end; |
Alle Zeitangaben in WEZ +1. Es ist jetzt 09:25 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz