• Welcome to Forum.Deepsoftware.Com. Please login or sign up.
 

How to send string to connected client by nrsocket servermode ?

Started by sxbug, July 02, 2022, 12:39:26 pm

Previous topic - Next topic

sxbug

I have a nrSocket Server, and  some clients connected to him,  How can I send string to a client?

sxbug

Can't the nrsocket servermode send data to the specified client? I think nrSocket's Server can create a list of clients and send data to the  specified client.

Roman Novgorodov

Hello

Did you try to look at SocketClientDemo and SocketServerDemo sample projects ?

Roman Novgorodov
DeepSoftware llc
DeepSoftware llc - The professional components for Delphi/CBuilder/.NET. The high quality custom software development.
Forums.nrCommLib.Com - DeepSoftware Tech Support Forum.

sxbug

I have seem these  example SocketClientDemo and SocketServerDemo . In the SocketServerDemo, it can only send characters to the client by manually entering characters through the terminal. I want to send arbitrary data to the client on the servermode, including invisible characters. How do I realize it?

I try to changed memo to nrTerminal

mystr:='12345678';
  //mystr[1]:=#01;  mystr[2]:= #03;   mystr[3]:= #00;   mystr[4]:= #00;
  //mystr[5]:= #00; mystr[6]:= #$2A ; mystr[7]:=#$C4;   mystr[8]:= #15;
  //nrSocket1.SendString(mystr);           //In ServerMode ,  What can this function do?
  if pgConnections.PageCount > 0  then begin
    myTerm:= form1.FindComponent('myTerm1');   //myTerm1 was Automatically generated
    If myTerm is TnrTerminal then begin
       TnrTerminal(MyTerm).SetFocus;
       TnrTerminal(MyTerm).BeginUpdate;
       TnrTerminal(MyTerm).TerminalInputStr(mystr);   //These char only display in server Terminal, but NOT send to client
       TnrTerminal(MyTerm).EndUpdate;
       keybd_event(65,0,0,0);                                       //Only this char send to Client
       //TnrTerminal(MyTerm).
       //TMemo(MyMemo).
    end;
  end;

sxbug

@Roman Novgorodov,Thanks

I've tried for a long time, but I still haven't solved this problem,Thank you for your help.


     sxbug

sxbug

I also have a suggestion: don't have too many compilation conditions in the example program, and don't use multithreading in the example program, which will cause too many problems in some programs integration. thank you

Now, after integrating the SocketServerDemo and the DataProc DEMO program, I find that the acquisition function does not execute.( TForm1.nrDataProcessor1DataPacket(Sender: TObject;  Packet: TnrDataPacket);)Why?



Thanks for your help

sxbug

I have solved all problem, mainly because there are too few documents provided by you.
Thanks。