Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
28
Task/Sockets/Pascal/sockets-2.pas
Normal file
28
Task/Sockets/Pascal/sockets-2.pas
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
Program Sockets_ExampleB;
|
||||
|
||||
Uses
|
||||
sockets;
|
||||
|
||||
Var
|
||||
TCP_Sock: integer;
|
||||
Remote_Addr: TSockAddr;
|
||||
|
||||
Message: string;
|
||||
PMessage: Pchar;
|
||||
Message_Len: integer;
|
||||
|
||||
Begin
|
||||
Remote_Addr.Sin_family := AF_INET;
|
||||
Remote_Addr.Sin_addr := StrToNetAddr('127.0.0.1');
|
||||
Remote_Addr.Sin_port := HtoNs(256);
|
||||
|
||||
TCP_Sock := fpSocket(AF_INET, SOCK_STREAM, IPPROTO_IP);
|
||||
|
||||
fpConnect(TCP_Sock, @Remote_Addr, SizeOf(Remote_Addr));
|
||||
|
||||
Message := 'Hello socket world';
|
||||
PMessage := @Message;
|
||||
Message_Len := StrLen(PMessage);
|
||||
|
||||
fpSend(TCP_Sock, PMessage, Message_Len, 0);
|
||||
End.
|
||||
Loading…
Add table
Add a link
Reference in a new issue