Void __fastcall tform1 :: nmstrm1hostresolved (tcomponent * sender) {statusbar1 - $ # @ 62; simpletext = "host resolved";} // --------------------- -------------------------------------------------- --- // Generate this event void __fastcall tform1 :: nmstrm1mentcallsent ("has file sent to each other" when the file is sent to the other party;} // --------- -------------------------------------------------- ---------------- // Generate this event void __fastcall tform1 :: nmstrm1packetSent (TOBJECT * Sender) {Statusbar1 - $ # @ 62; SimpleText = INTOSTR (NMSTRM1 $ # @ 62; bytesrecvd) "Bytes of" NMSTRM1 - $ # @ 62; bytestotal "Sent";} // --------------------- -------------------------------------------------- ---- Void __fastcall tform1 :: nmstrm1status (tcomponent * sender, Ansistring status) {if (statusbar1! = 0) statusbar1 - $ # @ 62; simpletext = status;} // ---------- -------------------------------------------------- --------------- // Does this event void __fastcall tform1 :: nmstrm1invalidhost (Bool & Handled) {ANSISTRING NewHost; IF (INPUTQUERY ", please enter The host name to send: ", newhost) {nmstrm1 - $ # @ 62; host = n EWHOST; EDIT1 - $ # @ 62; text = newhost;}} // ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------- // means the client is connected to Server void __fastcall tform1 :: nmstrMserv1clientContact (TOBJECT * Sender) {statusbar1 - $ # @ 62; simpletext = "client contact";} // ------------------- -------------------------------------------------- ------ // Receive the file void __fastcall tform1 :: nmstrMserv1msg (tComponent * sender, const Ansistring sfrom, tstream * strm) {ix (".// tmp.bmp")) deletefile (".//tmp.bmp""; myfstream = new tfilestream (".// Tmp.bmp", fmcreate; try {myfstream - $ # @ 62;
CopyFrom (Strm, Strm - $ # @ 62; size);} catch (...) {} myfstream - $ # @ 62; free ();} // ------------- -------------------------------------------------- ------------ Void __fastcall tform1 :: nmstrMserv1status (Tcomponent * sender, Ansistring status) {ix (statusbar1! = 0) statusbar1 - $ # @ 62; simpletext = status;} // -------------------------------------------------- ----------------------- After the code, the program is compiled, running it on both computers, each party can do server or workstation As long as the other party runs the program, you can send an image file to it, or you can do it on a single machine, try it!