Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
tintin++ ogg sound player script for linux
Author: Robert Smith
Submitted by: Vladaar
6Dragons ogg Soundpack
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.4
Author: Vladaar
Submitted by: Vladaar
LoP 1.46
Author: Remcon
Submitted by: Remcon
LOP 1.45
Author: Remcon
Submitted by: Remcon
Users Online
CommonCrawl, DotBot, Yandex

Members: 0
Guests: 9
Stats
Files
Topics
Posts
Members
Newest Member
481
3,739
19,386
619
Alexander
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » Codebases » SmaugFUSS » - port numbers sometimes
Forum Rules | Mark all | Recent Posts

- port numbers sometimes
< Newer Topic :: Older Topic >

Pages:<< prev 1 next >>
Post is unread #1 Sep 25, 2006, 7:30 am
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,874
JoinedJul 26, 2005

Once in awhile I was getting a - port when someone connected. I was talking with Samson about it earlier while we were trying to fiqure out another issue and he mentioned that it was likly from the port being a(n) (signed/unsigned) short and being put into an int. After looking at it, it gets set by ntohs which is an unsigned short, yet descriptor_data uses int port; I have changed int port to unsigned short port on mine. It didn't give any issues and I'm not sure if it has fixed it (considering it was only once in awhile I would get a - port), but fiqured I would go ahead and pass along the info before I forgot it later.
       
Post is unread #2 Sep 27, 2006, 7:17 am   Last edited Sep 27, 2006, 7:17 am by Remcon
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,874
JoinedJul 26, 2005

Decided to see why we get - port displays even if you change it to unsigned short.
It is displayed in a %hd which doesn't display all the possible ports and after a certian port number it will start doing it in - instead of displaying the correct port.
%hd=32381 %d=32381
%hd=32637 %d=32637
%hd=-32643 %d=32893
%hd=-32387 %d=33149

So change the %hd to %d in the display and it should stop the - ports. I didn't get
any complaints in doing so.
       
Post is unread #3 Sep 27, 2006, 8:19 pm
Go to the top of the page
Go to the bottom of the page

Conner
Sorcerer
GroupMembers
Posts870
JoinedMay 8, 2005

That's it? Just open comm.c, find new_descriptor and change
sprintf( log_buf, "Sock.sinaddr:  %s, port %hd.", buf, dnew->port );
to
sprintf( log_buf, "Sock.sinaddr:  %s, port %d.", buf, dnew->port );
..figures that it'd be something that minor given how many ways we tried to play with the sizeof portion of the
from = gethostbyaddr( ( char * )&sock.sin_addr, sizeof( sock.sin_addr ), AF_INET );
line right below that one. *sigh*
       
Post is unread #4 Sep 30, 2006, 7:44 pm
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,643
JoinedJan 1, 2002

It's the simple things that often take the longest to find :)
       
Post is unread #5 Sep 30, 2006, 7:55 pm
Go to the top of the page
Go to the bottom of the page

Conner
Sorcerer
GroupMembers
Posts870
JoinedMay 8, 2005

Well, this is one that Remcon and I tried several approaches to tackle and finally gave up on it until recently when Remcon apparently figured it out. It was trivial enough that I never bothered to post about it.
       
Post is unread #6 Sep 30, 2006, 7:58 pm
Go to the top of the page
Go to the bottom of the page

GatewaySysop
Conjurer
GroupMembers
Posts392
JoinedMar 7, 2005

Samson said:

It's the simple things that often take the longest to find :)


I noticed that the int port change to unsigned short port wasn't noted as part of the posted fix. Is there a reason for this? Is that particular change ill-advised for any reason or should that also be done?

       
Post is unread #7 Sep 30, 2006, 8:04 pm
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,874
JoinedJul 26, 2005

I'd undone mine and put it back to int. Either way should be fine. Not exactly sure why we use an int considering ntohs returns an unsigned short though. Since it is useing %d in most places though it just seemed to make more sense to change it back to an int for me lol.
       
Pages:<< prev 1 next >>