help files
Z505 | PasWiki | FUQ | Search | Main Docs | API Guide



[Overview][Constants][Types][Classes] Reference for unit 'blcksock' (#synapse)

TBlockSocket.Bind

Declaration

Source position: blcksock.pas line 355

public procedure TBlockSocket.Bind(

  IP: String;

  Port: String

);

Notes

Binds to an IP address and port... If bind fails then ??? what to do?

Example

var fSock: TTCPBlockSocket;
..
...
  With fSock Do
  Begin
    CreateSocket;
    SetLinger(True, 10);
    Bind(fIP, fPort);
    // below does not seem detect a problem if port not available though???
    if LastError<>0 then writeln('there was an error');
    writeln('blah');
    Listen;
    Repeat
      If Terminated Then 
        Break;
      If CanRead(1000) Then
      Begin
        ClientSock := Accept;
        If LastError = 0 Then
          TTCPHttpThrd.Create(ClientSock)
        Else
          WriteLn('there was an error');
      End;
    Until False;
  End;





lufdoc, Powtils, fpc, freepascal, delphi, kylix, c/c++, mysql, cgi web framework docs, Z505