Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

help with sending info via socket!

DevelopmentDevelopment Member Posts: 222
why will my code not work it sends the first line but after that tbutton off and the rest dont get sent to client anyidears??

[code]
if command = 'SPNSENDON' then
begin
bTalking := True;
Broadcast(Socket, 'SPEAKNAME' + chr(9) + username + #9 +
'TBUTTONOFF' + #9 +
'TAKERON' + #9 +
'MICBUTTON' + #9 +
'MICSPEAKNAME' + chr(9) + username);

end;
[/code]

SEND BUTTON OFF COMMAND

[code]
if command = 'SPNSENDOFF' then
begin
bTalking := False;
Broadcast(Socket, 'NONAME' + #9 + 'TBUTTONON');
end;
[/code]
Slewis

Comments

  • GaashiusGaashius Member Posts: 349
    Maybe try to send the data like this:
    [code]
    Broadcast(Socket, 'SPEAKNAME' + [red]#9[/red] + username + #9);
    Broadcast(Socket, 'TBUTTONOFF' + #9);
    Broadcast(Socket, 'TAKERON' + #9);
    Broadcast(Socket, 'MICBUTTON' + #9);
    Broadcast(Socket, 'MICSPEAKNAME' + [red]#9[/red] + username);
    [/code]
    (I've marked red that #9 which I have modified from chr(9) - I don't know why you're using chr(9), maybe you have overridden the proc, and it means some other. If you haven't, #9 and chr(9) means the same. This is not a problem, I have just marked it that it is changed.)

    It's possible that this BroadCast proc does not support too long strings, and the rest of the data have cut.

    Hope this did it

    **************
    Any questions? Just ask!

    :-) [b][blue]GAASHIUS[/blue][/b] :-)


  • DevelopmentDevelopment Member Posts: 222
    here the code for both ways of sending from my server!

    [code]
    procedure Tc_form_main.BroadCast(Socket: TCustomWinSocket; Data: string);
    var
    i: integer;
    begin
    for i := 0 to ServerSocket1.Socket.ActiveConnections - 1 do
    begin
    try
    ServerSocket1.Socket.Connections[i].SendText(Data + '#')
    except
    // Error broadcasting data
    end;
    end;
    end;
    [/code]
    [code]
    procedure Tc_form_main.SendData(Socket: TCustomWinSocket; Data: string);
    begin
    try
    Socket.SendText(Data + '#');
    except
    // Error sending
    end;
    end;
    [/code]

    is it like you says it unable to send long data??
    Slewis

  • GaashiusGaashius Member Posts: 349
    : here the code for both ways of sending from my server!
    :
    : [code]
    : procedure Tc_form_main.BroadCast(Socket: TCustomWinSocket; Data: string);
    : var
    : i: integer;
    : begin
    : for i := 0 to ServerSocket1.Socket.ActiveConnections - 1 do
    : begin
    : try
    : ServerSocket1.Socket.Connections[i].SendText(Data + '#')
    : except
    : // Error broadcasting data
    : end;
    : end;
    : end;
    : [/code]
    : [code]
    : procedure Tc_form_main.SendData(Socket: TCustomWinSocket; Data: string);
    : begin
    : try
    : Socket.SendText(Data + '#');
    : except
    : // Error sending
    : end;
    : end;
    : [/code]
    :
    : is it like you says it unable to send long data??
    : Slewis
    :
    :

    Yes, it is [b][red]possible[/red][/b] that SendText does not support long data. Seeing this BroadCast procedure it has no problem.

    Just try the particular sending of the data. If it doesn't work, I don't know... strange things are these. Maybe you can tell me detailed information about what do you want to do - I could help better.

    **************
    Any questions? Just ask!

    :-) [b][blue]GAASHIUS[/blue][/b] :-)


  • DevelopmentDevelopment Member Posts: 222
    do u have msn mate?
    Slewis

  • GaashiusGaashius Member Posts: 349
    : do u have msn mate?
    : Slewis
    :
    :
    Maybe no... Does that splitted data sending work?

    ****************
    Any questions? Just ask!

    :-) [b][blue]GAASHIUS[/blue][/b] :-)


  • DevelopmentDevelopment Member Posts: 222
    work fine like this

    Broadcast(Socket, 'SPEAKNAME' + #9 + username + #9);
    Broadcast(Socket, 'TBUTTONOFF' + #9);
    Broadcast(Socket, 'TAKERON' + #9);
    Broadcast(Socket, 'MICBUTTON' + #9);
    Broadcast(Socket, 'MICSPEAKNAME' + #9 + username);


    but when I try and make it in to just one broadcast line it dont work :(
    Slewis

  • GaashiusGaashius Member Posts: 349
    : work fine like this
    :
    : Broadcast(Socket, 'SPEAKNAME' + #9 + username + #9);
    : Broadcast(Socket, 'TBUTTONOFF' + #9);
    : Broadcast(Socket, 'TAKERON' + #9);
    : Broadcast(Socket, 'MICBUTTON' + #9);
    : Broadcast(Socket, 'MICSPEAKNAME' + #9 + username);
    :
    :
    : but when I try and make it in to just one broadcast line it dont work :(
    : Slewis
    :
    :
    Why do you need it in one line?

    ****************
    Any questions? Just ask!

    :-) [b][blue]GAASHIUS[/blue][/b] :-)


  • DevelopmentDevelopment Member Posts: 222
    trying to cut down on the sending commands want it all in one command to stop lag because it has a delay on sending all info
    Slewis

  • GaashiusGaashius Member Posts: 349
    : trying to cut down on the sending commands want it all in one command to stop lag because it has a delay on sending all info
    : Slewis
    :
    :
    If the one-line solution does not work, the multi-line solution may be the fastest. Sending it in one command will not make it faster, I think it depends on the size of data in bytes.

    Is that delay very big?

    ****************
    Any questions? Just ask!

    :-) [b][blue]GAASHIUS[/blue][/b] :-)


  • DevelopmentDevelopment Member Posts: 222
    no but you can tel its there
    Slewis

Sign In or Register to comment.