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 8702753
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T02:43:50+00:00 2026-06-13T02:43:50+00:00

I read the documentation , but it is not clear whats the difference between

  • 0

I read the documentation, but it is not clear whats the difference between bind() and connect() methods.

  • 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-06-13T02:43:51+00:00Added an answer on June 13, 2026 at 2:43 am

    bind() causes the socket to listen for incoming requests on a particular interface/port. In other words, it’s used by servers to respond to incoming requests. Only one socket can bind a port.

    connect() causes the socket to make a connection to an address/port serviced by a different socket. In other words, it’s used by clients to connect to a server. Multiple clients can connect to a port. NOTE: connect() is not required for use with UDP (datagram) sockets, only TCP/IP. UDP is a broadcast protocol, and connect() does not even require that a socket is listening to the other end.

    Something like this (adapted from the docs and untested) should send and receive the message “Hello, turnip!” to itself on port 12345:

    package
    {
        import flash.events.DatagramSocketEvent;
        import flash.net.DatagramSocket;
    
        public class TestClass
        {
            private var serverSocket:DatagramSocket = new DatagramSocket();
            private var clientSocket:DatagramSocket = new DatagramSocket();
    
            public function TestClass():void
            {
                this.serverSocket.bind(12345, "127.0.0.1");
                this.serverSocket.addEventListener(DatagramSocketDataEvent.DATA, dataReceived);
                this.serverSocket.receive();
    
                send("Hello, turnip!");
            }
    
            public function sendData(message:String):void
            {
                var data:ByteArray = new ByteArray();
                data.writeUTFBytes(message);
    
                try
                {
                    clientSocket.send(data, 0, 0, "127.0.0.1", 12345);
                    trace("sending:  " + message);
                }
                catch (error:Error)
                {
                    trace(error.message);
                }
            }
    
            private function dataReceived(e:DatagramSocketDataEvent):void
            {
                var data:String = e.data.readUTFBytes(e.data.bytesAvailable);
                trace("received: " + data);
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've read the arrow notation documentation page , but it's not entirely clear to
I've read all of the Jquery Validate documentation but I'm still not clear on
I read the documentation, but I did not understand what is the purpose of
I've read the documentation , but I'm still not sure I understand everything. Especially
I have read through the facebook developers documentation and it is not clear to
I have tried searching on Google and also read the documentation but no success.
I read all of Microsoft's documentation but their claim is that it should work
I've read about hydration in doctrine's documentation but I still can't understand what it
I have read the documentation and searched all over but I can't find how
I've read some documentation on how Adaboost works but have some questions regarding it.

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.