|
-
Apr 22nd, 2011, 10:51 PM
#1
Thread Starter
Lively Member
C# Sockets
Hi Guys,
I have a program that is meant to connect to a game server over TCP port 8080. The connection is all good, and as far as I can tell I am able to send packets. What I need to know is how to Receive every packet the game server sends back. Keep in mind it is sending well over 30packets a second back. Would I just write a while(true) loop to receive or is there something im missing?
Thanks,
Josh
-
Apr 23rd, 2011, 12:22 AM
#2
Re: C# Sockets
Depending on the circumstances, you might also consider using asynchronous methods.
Also, don't use While True when you can just use Do.
-
Apr 25th, 2011, 12:55 AM
#3
Thread Starter
Lively Member
Re: C# Sockets
Thanks I think I will end up making a Packet handling function and then run it on a separate thread. I guess I could just use a Do (thanks I forgot that while(true)'s are a bit dodgy) loop checking if socket.Receive != 0 and then call A seperate funtion to do the checking, and if it does = 0 (no packet to receive) then just return 0!
Thanks though 
-Josh
-
Apr 25th, 2011, 01:00 AM
#4
Thread Starter
Lively Member
Re: C# Sockets
Ok... This has nothing to do with sockets... but since you will most likely check this thread again since I replied, I'll ask it here. I need a pretty simple but effective activation system for it... I found this page- http://www.codeproject.com/KB/securi...ctivation.aspx. What do you think? And if it's enough for simply limiting usage to one user or more, could you please head me on the right track as that page isn't very helpful -.-
-Josh
-
Apr 25th, 2011, 01:37 AM
#5
Re: C# Sockets
 Originally Posted by jmcilhinney
Also, don't use While True when you can just use Do.
Oops! Forgot I was in C#. Doesn't apply.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|