Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7516885
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T01:16:33+00:00 2026-05-30T01:16:33+00:00

Hi I am trying to send a simple HTTP message from Flex to C#

  • 0

Hi I am trying to send a simple HTTP message from Flex to C# server, but it seems that I am getting tow calls, first is the real one and the second is an empty one.

Why is that and how can I handle it?

This is my C# code:

TcpListener listener = new TcpListener(IPAddress.Any, 9400);
listener.Start();
Console.WriteLine("Server started");
Socket client;
while (true)
{
    client = listener.AcceptSocket();
    // client.Available is an expensive call so it's just for testing
    Console.WriteLine("Client accepted " + client.Connected + " " + client.Available);
    SocketHandler handler = new SocketHandler();
    ThreadPool.QueueUserWorkItem(handler.handleSocket, client);
} 

this is the SocketHandler:

public void handleSocket(object socketObjeck)
{
    try
    {
        socket = (Socket)socketObjeck;
        byte[] buffer = new byte[1024];
        SocketSettings.setSocket(socket);
        //blocker...
        try
        {
            socket.Receive(buffer);
        }
        catch (Exception e)
        {
            Console.WriteLine("Error\nFaild reading from socket\n" + e.Message);
            socket.Close();
            return;
        }
        parseData(buffer);

        socket.Close(3);
    }
    catch (Exception e)
    {
        Console.WriteLine("Error\nError \n" + e.Message + "\n" + e.StackTrace);
    }
}

And this is my flex code:

var request:URLRequest = new URLRequest();
request.data = "Hello from flex";
request.url = URL;
request.method = URLRequestMethod.POST;
loader.load(request);

I am always getting 2 calls.
The line:

Console.WriteLine("Client accepted " + client.Connected + " " + client.Available);

called twice.
What am I missing?

Edit 1:
I can tell you for sure that the second call is empty, it’s not even seen in chrome JavaScript console, it’s like flex opening a connection, and waiting for some response or I don’t know what… but it sending no data.

Edit 2:

I been trying to send a true HTTP response a notice another thing, the second call is coming without waiting for the first call, if I am putting the response thread to short sleep(100 milliseconds in my test) then I am getting the second call before I been able to response for the first one.

P.S
Using Flex 4.6, Visual Studio 2010

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T01:16:34+00:00Added an answer on May 30, 2026 at 1:16 am

    After all it turn around that it were the crossdomain request. If you do not adding a crossdomain file in you www folder, flex will send you an empty message(if you will try to response this message with crossdomain, it want work).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to make a simple HTTP server that would be able to
I have a very simple workflow that is just trying to send an email
I am trying to do a simple app that will send email. The constructor
I am trying to send an email from a site I am building, but
Im trying to send simple login/password parameters to my PHP file in my server
I am trying to send a simple HTTP request like this: var client =
I'm trying to make a simple http client server using java. It will show
I'm creating quick web app that needs to send a php-created message from within
I am trying to do a simple Flex AMF call to a ColdFusion server
I'm trying to create a simple message form using navigateToURL() and PHP mail(). But

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.