Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ SMAUG
➜ Running the server
➜ DNS vs IP
It is now over 60 days since the last post. This thread is closed.
Refresh page
Pages: 1
2
3
Posted by
| David Haley
USA (3,881 posts) Bio
|
Date
| Reply #30 on Tue 21 Jun 2005 07:15 PM (UTC) |
Message
| I said to not store it in pcdata because conceptually that's not where it belongs, but if you have extra requirements (e.g. IP addresses persist after deconnection) then it makes sense to put it there.
The line I give you doesn't target anybody. As I said, it comes from the code that accepts connections. It takes the socket structure that was just obtained from accept() and grabs the socket address. It is not something you would use anywhere else in your code. In fact, if you grep for inet_ntoa you will probably end up in the socket accepting code. |
David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone
http://david.the-haleys.org | Top |
|
Posted by
| Zeno
USA (2,871 posts) Bio
|
Date
| Reply #31 on Tue 21 Jun 2005 07:23 PM (UTC) |
Message
| Well I don't understand since if it is only used in new_descriptor, how am I suppose to display it with a character? The character loading is dealt with in nanny. |
Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org | Top |
|
Posted by
| David Haley
USA (3,881 posts) Bio
|
Date
| Reply #32 on Tue 21 Jun 2005 08:59 PM (UTC) |
Message
| When you load the character in nanny, you have the descriptor, right? So if you store the IP address (in string form after inet_ntoa or in the sock_sinaddr form), you can then stick it into the pcdata structure or wherever it is you want to put it. |
David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone
http://david.the-haleys.org | Top |
|
Posted by
| Greven
Canada (835 posts) Bio
|
Date
| Reply #33 on Tue 21 Jun 2005 10:25 PM (UTC) |
Message
| So STRALLOC the result of inet_ntoa into a string on the DESCRIPTOR_DATA structure to save it and have an in game one easily available? Make sense.
Does your finger code load the charactes to read in the data? Or does it write to a file, and the finger command checks that?
Either way, you could just copy the value from ch->desc->ipstring to ch->pcdata->ipstring, or you could write to the file(s) from ch->desc->ipstring directly, though with this the IP will not persist if the character is loaded by an imm and forced to save. |
Nobody ever expects the spanish inquisition!
darkwarriors.net:4848
http://darkwarriors.net | Top |
|
Posted by
| Zeno
USA (2,871 posts) Bio
|
Date
| Reply #34 on Wed 22 Jun 2005 02:05 AM (UTC) |
Message
| The finger is the latest snippet, so it loads and reads the player file.
Storing it in a buf yes I know, but I need to write the buf someone in order to read it in another function. Are you saying to change the header of the functions to store this buf? |
Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org | Top |
|
Posted by
| David Haley
USA (3,881 posts) Bio
|
Date
| Reply #35 on Wed 22 Jun 2005 02:30 AM (UTC) |
Message
| What's the problem with just writing the buf into the descriptor, and then writing it into the pcdata in nanny? I'm not sure I understand the problem. |
David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone
http://david.the-haleys.org | Top |
|
Posted by
| Zeno
USA (2,871 posts) Bio
|
Date
| Reply #36 on Wed 22 Jun 2005 02:36 AM (UTC) |
Message
| Oh wait, storing the buf into the descriptor? Could you give me an example line so I understand completely? |
Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org | Top |
|
Posted by
| Greven
Canada (835 posts) Bio
|
Date
| Reply #37 on Wed 22 Jun 2005 05:45 AM (UTC) |
Message
| You could probably do this:
Add a field to your DESCRIPTOR_DATA in mud.h by addingThen, in new_descriptor in comm.c, add the following:
dnew->ipstring = STRALLOC(inet_ntoa( sock.sin_addr ));
This should create a a string based on the ip, allocate the memory for it, and change d->ipstring to point to that memory. You should, I beleive add it right above:if (!sysdata.NO_NAME_RESOLVING)
No testing was done, but that should give you the ip adress as a string allocated into a field in their descriptor data, and this would allow you to copy it later into their pcdata. |
Nobody ever expects the spanish inquisition!
darkwarriors.net:4848
http://darkwarriors.net | Top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
94,317 views.
This is page 3, subject is 3 pages long:
1
2
3
It is now over 60 days since the last post. This thread is closed.
Refresh page
top