Announcement

Collapse
No announcement yet.

Simple question about EchoServ.bas TCP Echo Server Example for PowerBASIC for Windows

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Simple question about EchoServ.bas TCP Echo Server Example for PowerBASIC for Windows

    Dear PB users,

    I have one simple question regarding this sample program:

    Code:
    DO
       TCP RECV hEcho, 1024, sBuffer
       sPacket = sPacket + sBuffer
    LOOP UNTIL sBuffer = "" OR ISTRUE EOF(hEcho) OR ISTRUE ERR
    
    ' Send it back!
    IF LEN(sBuffer) THEN TCP SEND hEcho, sPacket + " -> Received Ok!"
    I'm curious to understand why after the loop we test IF LEN(sBuffer) THEN ... ? from my understanding it should be IF LEN(sPacket) THEN ...

    Do you agree ?
    Jean-Pierre LEROY

  • #2
    Oops, I misread it.

    Yes, you should return it if sPacket contains something.

    Comment


    • #3
      Thank you Stuart for your confirmation.
      Jean-Pierre LEROY

      Comment

      Working...
      X