Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

C# 

Simple TCP Chat Client & Server

Bunnies Simple TCP Client & Server (Heavily Commented)



So it's been a while since I realeased something and that's mainly because I have no idea what to release.
But recently I've been doing alot of networking and I got really into the TcpClient class provided in the .NET Framework for C#.
So here it is!
A simple TCP Client & Server that will help you grasp the concept of how to make a chat application.


Server Listening

[Image: uIwohJ9.png]

Server & Client Working Together

[Image: xHqe9ZP.png]




Enjoy & I hope you learn something! 🤝


Thanks to Finn for adding the credits, forgot to mention him in the code! 🤝

Quote:Finn. Wrote: ►
Saw the same code on stackoverflow, you just edited it a bit. Anyways thanks for sharing i guess.

http://stackoverflow.com/questions/10182...imple-text

Ooooh nice I needed something like this, thanks man!
(May 4, 2017 09:46 AM)Demauen Wrote:  Ooooh nice I needed something like this, thanks man!

Anytime! I'm glad I could help! 🤝
not multithreading just one connection ...
[Image: bitcoin.png] Be Nice For Once 15hVUVz7xA4kazHdk2BuErENGCskVwjYXP
(May 4, 2017 10:15 AM)HFDone Wrote:  not multithreading just one connection ...

Did you even read the thread?

Quote:A simple TCP Client & Server that will help you grasp the concept of how to make a chat application.

Nice try multi threading it now:)
Saw the same code on stackoverflow, you just edited it a bit. Anyways thanks for sharing i guess.

http://stackoverflow.com/questions/10182...imple-text
(May 4, 2017 11:26 AM)Finn. Wrote:  Saw the same code on stackoverflow, you just edited it a bit. Anyways thanks for sharing i guess.

http://stackoverflow.com/questions/10182...imple-text

Oh crap thanks!
Was support to add credits in the code but I forgot! I'll add you to the post 🤝
(May 4, 2017 12:26 PM)passwords Wrote:  Oh crap thanks!
Was support to add credits in the code but I forgot! I'll add you to the post 🤝

Why would you add him? He just saw it, not write it. lol.

Nice try with the share though :-)
(May 4, 2017 12:38 PM)tcsh Wrote:  Why would you add him? He just saw it, not write it. lol.

Nice try with the share though :-)

No I wasnt going to add Finn to the code haha I was going to add the guy from stack. 😁
(May 4, 2017 12:56 PM)passwords Wrote:  No I wasnt going to add Finn to the code haha I was going to add the guy from stack. 😁

Next time don't forget it^^
This is a very basic example, and you forgot to dispose of a few things, but thanks for the release. You should try using asynchronous methods such as BeginAccept and things like that. And sending your own data structures and using your own protocol. Maybe even checksum validation to ensure file integrity.


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Java] by OneHalfApr 30, 2026 12:09 PM 7 479 Apr 30, 2026 12:09 PM
Last Post: APIBoy
[C] by gurlhackerclubAug 31, 2020 09:34 PM 0 187 Aug 31, 2020 09:34 PM
Last Post: gurlhackerclub
[C] by nullbyteAug 30, 2020 02:43 AM 5 262 Aug 30, 2020 02:43 AM
Last Post: 4Txe4y33C9zvNhMj