• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Port in URL string: is it for destination or for source?

 
Ranch Hand
Posts: 3178
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am reading WMA 1.1 specification and I can't understand whether the port number(1234) specified in the URL string of client MessageConnection like sms://+123456789:1234 is the port number for the device that is going to send a message or the port number on the other device that the application have to send message to...

Please have a look at the following sentences from WMA 1.1 specification..

The first application to allocate a given port number will get it. If other applications try to allocate the same port number while it is being used by the first application, an IOException will be thrown when they attempt to open the MessageConnection. The same rule applies if a port number is being used by a system application in the device. In this case, the Java applications will not be able to use that port number.


According to the paragraph above, the port number should be of the source device.... but have a look at the following again...

For security reasons, Java applications are not allowed to send SMS messages to the port numbers listed in Table A-4. Implementations MUST throw a SecurityException in the MessageConnection.send() method if an application tries to send a message to any of these port numbers.


So the port number should be on the another device that we are going to send the message...

Help please...
 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Port number is of the device that is listening for incoming messages at the specified port.
Things will be clear after reading this (Push Registry):

When using a system-assigned address, you must publish this address so that external systems can connect to your aplication.
 
Ko Ko Naing
Ranch Hand
Posts: 3178
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Rahul JG:
Port number is of the device that is listening for incoming messages at the specified port.
Things will be clear after reading this (Push Registry):

When using a system-assigned address, you must publish this address so that external systems can connect to your aplication.



If it is the listening port on the device which WMA application is running, then why is the following portion is mandated in the WMA specification? Thanks for your explanation as well...


A.6.0 Restrictions on Port Numbers for SMS Messages
For security reasons, Java applications are not allowed to send SMS messages to the port numbers listed in Table A-4. Implementations MUST throw a SecurityException in the MessageConnection.send() method if an application tries to send a message to any of these port numbers.



Does it seem like we can specify the port number that is not listed in the table in our WMA application to send the message to???
 
Rahul JG
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
From the specs:

The receiving application in a device is identified with the port number included in the message. When opening the server mode MessageConnection, the application specifies the port number that it will use for receiving
messages.
These port numbers are split into ranges. The IANA (Internet Assigned Numbers Authority) controls one of the ranges.

Hence the exception
 
Rahul JG
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Look at it from the Push Registry perspective:

How does an application indicate to the Push Registry to activate it when there is a message on port 5000?

sms://:5000

In this case the application/Push Registry listens on port 5000.

Now if an application on some other device sends a message to port 5000, then for it, port 5000 is that of the destination application. I feel destination & source should be used in the proper context.
 
Ko Ko Naing
Ranch Hand
Posts: 3178
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
but yes, Rahul, I'm also wondering why there is a restriction for the reserved port number to send to, as I shown above... If we cannot specify the port number of the destination device, why is that restriction for?

Thanks a lot for your comment though...
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic