Shop OBEX P1 Docs P2 Docs Learn Events
Maximum port number — Parallax Forums

Maximum port number

LtechLtech Posts: 370
edited 2011-09-26 13:05 in Accessories
I have a trouble. With "Brilldea_W5100_Indirect_Driver_Ver006" in assembly
I have to use a propeller with port number 56629.

It do not work with 56629. Smaller numbers are fine. But the server is only reacting on 56629
In notice the bigest value for a port is 65533. So mine is theoretical in range.

With a udp test on pc on a lower port 5000 it works on 56629 not. It is faling on opening socket.

So i assume it is in the assembly code "Defined data" ?

Thanks a lot for helping me

Comments

  • Mike GMike G Posts: 2,702
    edited 2011-09-26 06:34
    The PASM code does not trim the low byte port values which cause expected results in #WriteSingle . Find the sOPEN label and add the following line in two places in the source code. Please test, I'm not sure if this causes issues elsewhere in the code. If unit testing works out, I'll update the Google repository.
    and       data,   #$FF            'Filter the low byte MG 9/26/2011
    


    It should look like this.
    '-----------------------------------------------------------------------------------------------------
    'Command sub-routine for opening a socket
    'this routine relies upond t0 being persistant across calls to writing routines
    '-----------------------------------------------------------------------------------------------------
    sOPEN
                  mov       t0,     paramA          'Move the socket number into t0 ($000s)
                  shl       t0,     #8              'Move the socket number to the third digit ($0s00).  This is the offset to use for below ops.
    
                  'set the mode
                  mov       reg,    _S0_MR_d        'Move the register address into a variable for processing
                  add       reg,    t0              'Add in the offset for the particular socket to be worked on
                  mov       data,   paramB          'Move over the socket type
                  call      #WriteSingle            'Write the byte to the W5100
    
                  'set the source port
                  mov       reg,    _S0_PORT1_d     'Move the register address into a variable for processing
                  add       reg,    t0              'Add in the offset for the particular socket to be worked on
                  mov       data,   paramC          'Move over the source socket value
                  and       data,   #$FF            'Filter the low byte MG 9/26/2011  
                  call      #WriteSingle            'Write the byte to the W5100
                  sub       reg,    #1              'Increment the register address
                  mov       data,   paramC          'Move over the source socket value
                  shr       data,   #8              'shift the data over one byte
                  and       data,   #$FF            'Filter the low byte MG 9/26/2011
                  call      #WriteSingle            'Write the byte to the W5100
    
  • Beau SchwabeBeau Schwabe Posts: 6,557
    edited 2011-09-26 07:50
    Mike G,

    just tested... seems that the limit is 32767 ... I'm suspicious that the sign bit might be getting in the way here.
  • LtechLtech Posts: 370
    edited 2011-09-26 07:59
    Yes the spinneret opens a socket on port 56629. (terminal window info)
    I can't test the real udp connetion server down now

    ****** You have to modify the destination and the source port ....******

    Thanks Mike it helps me a lot
  • LtechLtech Posts: 370
    edited 2011-09-26 13:05
    Yes it works on port 56629
Sign In or Register to comment.