hi, i want to connect to a server on port 808m but my compiler bleat about this line:
port DB 808

What I have made wrong ?

Thanks in advance.
Posted on 2003-04-15 21:45:28 by Forginforcer
what was the error message? which assembler are you using?

perhaps "port" is reserved? (though i don't think it is in MASM)
Posted on 2003-04-15 23:11:30 by jademtech
A port number is a word (dw), not a byte (db). Besides, you don't need to declare a variable for the port number if it's going to be fixed anyway. Just use a constant:

PORT_NR equ 808

Don't forget to use htons before putting it in the sockaddr_in struct. You can also leave the htons call out and convert the port number to network byte order yourself (swap low and high byte, ie 808 (0328h) will be 10243 (2803h)).

Posted on 2003-04-16 02:29:42 by Thomas
forgin, perhaps you should read up a bit on data types.
db = byte = 8 bits = [0-255]. How do you expect to put the integer value "808" in a byte?
Posted on 2003-04-16 02:47:32 by f0dder
Hi thanks !
I was tired at am 5:00 I couldn distinguish DD with DB *hihih*.

I thought DB 808 means '8'',0','8'

Thanks again.
Posted on 2003-04-16 03:38:37 by Forginforcer

I was tired at am 5:00 I couldn distinguish DD with DB *hihih*.

Which would also be wrong - ports are words. "dw".

I thought DB 808 means '8'',0','8'

Which would be even more wrong - ascii string rather than decimal value.
Posted on 2003-04-16 03:41:25 by f0dder
Hey, I think I'm also tired *hihihiih*

I know dadatypes, THX !

WEll done...
Posted on 2003-04-16 03:52:21 by Forginforcer