#local tcp task

25 messages · Page 1 of 1 (latest)

worn otter
#

What messages do you get?

swift pivot
#

Working on Linux as you see message interpreted twice

#

But on receiver side once but the issue is the message repeats twice if condition makes timestamp removed

worn otter
#

Your function is super long. It's a bit difficult to read with that many locks and unlocks etc.

swift pivot
#

@worn otter any help or videos I need help

worn otter
#
Welcome to TCP-Chat!
Bob
Hello!
[13-09-2024 20:05:53][Bob]: Hello!
What's up?
[13-09-2024 20:06:05][Bob]: What's up?
How well does this work?
[13-09-2024 20:06:25][Bob]: How well does this work?
Does this work as it should?
[13-09-2024 20:06:33][Bob]: Does this work as it should?
I see no problems.         
[13-09-2024 20:06:42][Bob]: I see no problems.

I don't see any issues.

#

Your screenshot looks good too.

swift pivot
#

@worn otter the issue is that name can't be empty so if I not write my name it doesn't stop

worn otter
#

What do you mean?

swift pivot
worn otter
#

Ah, hmmm

#

The best thing you could do is start separating code out so that it becomes easier to maintain and debug.

swift pivot
#

Is it OK if I say I can't or possible this way

worn otter
#

I don't understand.

swift pivot
#

Actually my colleagues code so I just need to debug

worn otter
#

Why do you have to debug it?

swift pivot
#

We have to submit to audit

worn otter
#

Submit to where? Audit by whom?

swift pivot
#

School project

worn otter
#

So your issue is somewhere around here?

    // Read the name from the client
    var name string
    for {
        if scanner.Scan() {
            name = scanner.Text()
            if name != "" {
                break
            }
            fmt.Println("Name cannot be empty. \n Please enter your name again")
        }
        if err := scanner.Err(); err != nil {
            log.Println("Error reading from client:", err)
            return
        }
    }
#

What do you want to do when they don't enter a name?

#

The best thing would be to tell the client that it's not valid and disconnect.

#

And instead of printing it, send a response.

#

And then return from the handler.

worn otter
#

What error pops up?