Building a TCP Client in C#

Поделиться
HTML-код
  • Опубликовано: 23 ноя 2024

Комментарии • 15

  • @cryptoeric24
    @cryptoeric24 Год назад +2

    To bring in the import you can hover over Encoding and hit ctrl .

  • @shavais33
    @shavais33 5 месяцев назад

    Hey, great post, thanks for putting it up. A few questions:
    What happens if Connect fails without throwing and you need to retry?
    How do you know it failed and how do you get the error message?
    The docs I'm reading say you need to call EndConnect before using the connection.. is only for ConnectAsync?
    What if Connect hangs for a long time before failing? Is there a way to set a timeout that it will actually honor?
    What if it fails to honor the timeout, how can you kill it in a way that lets you retry after a few seconds?
    I need my client to repeatedly retry if/while the server is down, and I'm having trouble with Connect and ConnectAsync. They don't honor timeouts, they don't pay attention to cancel token sources being cancelled, they just hang.

  • @midknight3350
    @midknight3350 Год назад

    Bah! You stopped short of reading the incoming stuff! I needed to know that. 😢

  • @mduduzimdu6160
    @mduduzimdu6160 6 месяцев назад

    Hii I followed the steps but used port 8080. The connection cuts off after sending bytes. Please help

  • @begelston
    @begelston Год назад

    Thanks!

  • @dadamnmayne
    @dadamnmayne 2 года назад

    nice. it would be much more deadly if it could accept a url instead of an ip address, or maybe both.

  • @mmaranta785
    @mmaranta785 Год назад

    What does the “using” do?

    • @elevatecyber5031
      @elevatecyber5031  Год назад

      It's import statement. I basically allows me to use code that someone else already wrote in my program, so that I don't have to reinvent the wheel.

  • @epotnwarlock
    @epotnwarlock 2 года назад

    C# is kinda lame it won't let you craft your own tcp packets

    • @elevatecyber5031
      @elevatecyber5031  2 года назад

      You can. That's what the library I was using does. But you can always write the code yourself. Since it's such a standard library, I didn't bother.

    • @epotnwarlock
      @epotnwarlock 2 года назад

      @@elevatecyber5031 you can set specific flags in a tcp packet?

    • @MinokawaPH
      @MinokawaPH Год назад +1

      @@epotnwarlock Why would you even think it's a C# constraint? It's like saying C and C++ can't do stuff because a "SPECIFIC" library constraints you lol

    • @epotnwarlock
      @epotnwarlock Год назад

      @@MinokawaPH fundamental networking isn't a library, its a core feature of every language

    • @MinokawaPH
      @MinokawaPH Год назад

      ​@@epotnwarlock Do you even understand what you're saying? A "core feature" of a programming language is defined by its data types, syntax, and its memory control, and its functions.
      Isn't a library my ass. In C and C++, you use the standard library, would it be C and C++ without the standard library? No, because C is defined by its syntax, and its procedural programming. C++ on the otherhand defined by its syntax and its object-oriented programming. In C# they're called modules, and like the "standard library" of C and C++, they were DEVELOPED USING THE SAME LANGUAGE, most of which are open source.
      A goddamn "core feature" of the language is defined by its ability to be translated to machine language.