![]() ![]() What the various socket functions are doing, what the contents of the data structures are, and what order you need to use to do any particular thing.Ĭomplex client/server network apps are also often multi-threaded, which throws a-whole-nother dimension of complexity into the mix, but we can get into that later. The first thing you need to do is understand what is going on and why. However, turning them into something practical will be a long road indeed. Well, realize that these examples are real good for demonstrating the basics of socket / network programming. ServerAddr.sin_addr.s_addr :=htonl($7F000001) īuffer := 'This is a textstring sent by the Client.' ServerSocket := fpSocket(AF_INET,SOCK_STREAM,0) Procedure PrintError(Const Msg : String) Until (Count = SOCKET_ERROR) Or (Count = 0) Writeln('Waiting for Connect from Client, run now sock_cli in an other tty') Ĭount := (Count SOCKET_ERROR) And (Count > 0) Then ![]() If fpListen (ListenSocket,1) = SOCKET_ERROR Then ListenSocket := fpSocket (AF_INET,SOCK_STREAM,0) Procedure PrintError (Const Msg : String) ![]() If you just want to do it with the sockets unit, no fancy textfile-handling (which is annoying anyway), this should come closer to what you are looking for: I've had issues with the FP sockets unit being incomplete/wrong in the past. Now, they just pass-through to the underlying API socket calls, so those won't compile anymore without recompiling the sockets unit with the legacy symbol defined. The examples are ancient history, back to a time where they implemented socket-to-file functions, which are now deprecated. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |