What's new

.NET Trying to learn asynchronous sockets

  • Thread starter DaftHacker
  • Start date
  • Views 317
D

DaftHacker

Jet fuel can't melt steel beams
Messages
2,610
Reaction score
918
I'm trying more to learn about asynchronous sockets and i followed this tutorial: but its implemented into a console application and im trying to implement it into a class/form but a lot of the code directly writes messages through the console and im not exactly sure how i would return the messages. Also this tutorial just shows you the code and doesn't very much explain what it all actually does and doesn't have any disconnection handling or client ids/names. I've tried looking all over Youtube to try and find a good video tutorial explaining code, implementing into a class/windows forms, handle client disconnection, and handling/showing different client ids/names, but i have had little to no luck. Do you know of any good tutorials to learn all of the above ?
 
Last edited:
M

Mr Smithy x

Enthusiast
Messages
326
Reaction score
186
I'm trying more to learn about asynchronous sockets and i followed this tutorial: but its implemented into a console application and im trying to implement it into a class/form but a lot of the code directly writes messages through the console and im not exactly sure how i would return the messages. Also this tutorial just shows you the code and doesn't very much explain what it all actually does and doesn't have any disconnection handling or client ids/names. I've tried looking all over Youtube to try and find a good video tutorial explaining code, implementing into a class/windows forms, handle client disconnection, and handling/showing different client ids/names, but i have had little to no luck. Do you know of any good tutorials to learn all of the above ?
You should use handlers and interfaces when dealing with forms/gui stuff
 
D

DaftHacker

Jet fuel can't melt steel beams
Messages
2,610
Reaction score
918
You should use handlers and interfaces when dealing with forms/gui stuff
I have the events down, and i have the disconnecting down. I just need to get the client id stuff sorted and also selecting certain clients to send messages to from the server.
 
M

Mr Smithy x

Enthusiast
Messages
326
Reaction score
186
I have the events down, and i have the disconnecting down. I just need to get the client id stuff sorted and also selecting certain clients to send messages to from the server.
You should have an interface for when you recieve data and send data, its how ive done my servers in java
 
D

DaftHacker

Jet fuel can't melt steel beams
Messages
2,610
Reaction score
918
You should have an interface for when you recieve data and send data, its how ive done my servers in java
I see how interfaces are used but i fail to see how i would actually find it useful for my application or how i would even implement it. I just learned about them so im not fully experienced in implementing them in certain situations so just telling me to add something isn't much help. All i really need is to figure out how to get the client ids and other info like their name and add a system where i could send messages to certain clients, kick them, or anything else.
 
M

Mr Smithy x

Enthusiast
Messages
326
Reaction score
186
I see how interfaces are used but i fail to see how i would actually find it useful for my application or how i would even implement it. I just learned about them so im not fully experienced in implementing them in certain situations so just telling me to add something isn't much help. All i really need is to figure out how to get the client ids and other info like their name and add a system where i could send messages to certain clients, kick them, or anything else.

Interfaces to handle data that you can use on the main ui. if the users are going to have the same name when using the program, i reccommend you make a database to store your users. If you need help on how you should use interfaces and manage your clients shoot me a pm.
 
X

Xeren

♦♦♦ God Complex ♦♦♦
Messages
5,671
Reaction score
2,120
I don't know if this will help you, but it's an asynchronous socket client I'd made for a RAT. It's not the whole class, but I copied the first couple lines that correlate most to what you're attempting to do.
The HandleMessage function would scan and understand the message it receives and then execute the appropriate command.

I haven't opened the project in a while, but I'm pretty sure the client and server would both use this class to connect to each other. I had a C project that had been the server most the time though, so I might be wrong.
 
Top Bottom