0

http://msdn.microsoft.com/en-us/library/fx6588te.aspx?cs-save-lang=1&cs-lang=csharp#code-snippet-1

I've added a couple of things that look like this to it:

if (content.EndsWith("\x0")) 
{
     Console.ForegroundColor = ConsoleColor.Cyan;
     Console.WriteLine(content.ToString());
     String  retString = content.Substring(0, 1);

      if (retString == "<")
      {
          if (content.Contains("<policy-file-request/>"))
          {
               Console.WriteLine("is a policy");
               Send(handler, "<cross-domain-policy><allow-access-from domain='*' 
                               to-ports='*' /></cross-domain-policy>" + "\x0");
          }
          if (content.StartsWith("<doanyversioncheck/>"))
          {
               Console.WriteLine("is a version check");
               Send(handler, "yourv 1" + "\x0");
          }
      }
 }

I've looked around google as much as I can, but I'm stumped - no matter what, it always seems to only send one packet at a time to the user. Being newish to C# and sockets... well, it's hard, haha.

What can I do to fix this, so that a user can receive more than one packet, after sending many requests asking for different ones?

Thank you in advance!

Ben Reich
  • 16,222
  • 2
  • 38
  • 59
  • A couple of questions, From the example how are you setting up the socket you are passing to send? Where is the code that is calling send? Are you using the loopback address (127.0.0.1)? – Matt Johnson May 29 '13 at 05:29
  • @Matt-Johnson Hi, I replaced IPEndPoint localEndPoint = new IPEndPoint(ipAddress, 11000); with IPEndPoint localEndPoint = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 11000); - the code in my original question is contained after content = state.sb.ToString();. I've replaced the EOF part with the above. as for setting up the socket, I have a simple-ish flash client connecting to it, if that's what you mean. – user2430724 May 29 '13 at 10:20

0 Answers0