12 Replies Latest reply on Oct 8, 2009 4:56 AM by jylaxx

    Socket and port 80 strangeness

    jylaxx Level 1

      Hi,

      I did a search on the forum about this before posting and found a lot of thread but no anwser...

       

      Here what it is :

      socket.connect method always raise a CONNECT event on port 80, whatever is the host IP address (except for 127.0.0.1).

      If you replace 80 by any other value (e.g. 81) you have a normal behaviour (I mean receiving a connect event only when socket IS connected, and error event when connection is not possible.

       

      In fact there is no real connectionl because NO packets are send over tcp and writting any data will raise IOError event.

       

      I am multiplexing HTTP and a custom protocol over the same port of the server. Using port 80 seams to be the best choice.

       

      This problem has nothing to do with security policy as everything is working fine when other port is used (even lower than 1024). Anyway CONNECT event is raise without sending any TCP packet

       

      Thanks for help

       

      JYL

        • 1. Re: Socket and port 80 strangeness
          jylaxx Level 1

          up...

           

          Nobody has this problem or can reproduce this ??

           

          THX

          • 2. Re: Socket and port 80 strangeness
            jake_flex Level 2

            I gave this a try just out of curiosity and to me it seems that socket interface does not work correctly indeed. In my case every host and port combination gave the connect event. Only absurd host names and port numbers, such as "545.0.434.1", 90909090900, gave IO Error. The security event was never raised with port numbers lower than 1024, although the API reference says so.

             

            I'm using ActionScript 2, maybe something was fixed in version 3, but not the entire functionality.

             

            Can you try to take connection to a host that you are sure that it does not have a http server running? Does 'localhost' give the same result as 127.0.0.1?

            • 3. Re: Socket and port 80 strangeness
              jylaxx Level 1

              Well first of all, thanks for your curiosity ! I was feeling alone on this question !!

               

              I made some new tests and today I have the same incorrect behaviour for ALL IP including localhost. I will investigate that more...

               

              So I don't think there is any differences between AS2 and AS3.

               

              Anyway it seams to be a real problem. I don't understand why any expert can bring an explanation to that !

               

              BTW I use socket a lot and except this strangeness it is working very well.

              • 4. Re: Socket and port 80 strangeness
                jake_flex Level 2

                jylaxx wrote:

                 

                BTW I use socket a lot and except this strangeness it is working very well.

                It's working well if you know about this 'feature' and make your error handling while trying to read data from the socket, but if you are not aware of this and make your error handling based on the knowledge whether the connection is established or not, you'll get errors. Also, it might be hard to tell whether the server is not available or is just not sending anything.

                 

                Please report the findings of your investigations.

                • 5. Re: Socket and port 80 strangeness
                  Michael Borbor Level 4

                  Hi there, indeed it is a very odd behavior  I recommend you to do a search in the Flex Bug Base http://bugs.adobe.com/flex/ , it seems like a bug, and maybe this is already in the bug database and if it's not, add it to the bug base.

                  • 6. Re: Socket and port 80 strangeness
                    jylaxx Level 1

                    I have already done that, but I post in the FP part as socket is part of the flash.net package.

                     

                    https://bugs.adobe.com/jira/browse/FP-1866

                     

                    There is no comment until now...

                    • 7. Re: Socket and port 80 strangeness
                      jylaxx Level 1

                      jake_flex wrote:

                       

                      jylaxx wrote:

                       

                      BTW I use socket a lot and except this strangeness it is working very well.

                      It's working well if you know about this 'feature' and make your error handling while trying to read data from the socket, but if you are not aware of this and make your error handling based on the knowledge whether the connection is established or not, you'll get errors. Also, it might be hard to tell whether the server is not available or is just not sending anything.

                       

                      Please report the findings of your investigations.

                      Well I mean if you DO NOT use port 80

                      • 8. Re: Socket and port 80 strangeness
                        Michael Borbor Level 4

                        Well you know sometimes the bugs are a matter of popularity so I recommend you to vote for this bug, and tell your friend to vote for it so the bug will get a higher priority and maybe a solution sooner.

                        • 9. Re: Socket and port 80 strangeness
                          jylaxx Level 1

                          Well I can't vote for an issue I have reported !!

                           

                          But YOU can ;-)

                          • 10. Re: Socket and port 80 strangeness
                            jylaxx Level 1

                            I made some new tests and today I have the same incorrect behaviour for ALL IP including localhost. I will investigate that more...

                             

                             

                            Sorry for this confusion. I had a daemon running on port 80...

                             

                            So I confirm that on IP 127.0.0.1 (or localhost) the socket on port 80 has a normal behaviour.

                            • 11. Re: Socket and port 80 strangeness
                              jylaxx Level 1

                              I still expecting any answer or explanation about this problem...

                               

                              I have no answer from expert, and my bug report does not have any comment...

                               

                              Does flex has a hidden or dark side ?

                              • 12. Re: Socket and port 80 strangeness
                                jylaxx Level 1

                                Well, finally I am able to explain the problem. I still don’t really know if it is a bug or not…
                                I confirm that connections on port 80 are processed in a special way because the CONNECT event is dispatched nevertheless no TCP packet are sent to the server. The situation is that client appears to be connected but server don’t have any connection for this client.
                                Anyway when you write data on this socket a real connection is established and data are correctly processed.
                                But there is one thing that is not working with port 80 : serving the policy file request on the same port than the connection.
                                I am using a multiplexer server which serves various protocols on the same port. So it is why my connection on port 80 never works, because the policy file request was not processed.
                                If I set a policy file server on port 843 (default port used by Flash Player) I can use port 80 for my binary protocol.
                                Quite strange, anyway…