logo logo

 Back to main page

The NWNX Community Forum

 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
GetServerIP plugin?

 
Post new topic   Reply to topic    nwnx.org Forum Index -> Windows development
View previous topic :: View next topic  
Author Message
Primogenitor



Joined: 08 Jan 2005
Posts: 88

PostPosted: Tue Mar 08, 2005 15:17    Post subject: GetServerIP plugin? Reply with quote

Does anyone know of / can someone make a GetServerIP function? The reason behind this is for use in conjunction with Letoscript. As you may know already, NWNX-Letoscript is a plugin for NWNX that gives the power of Leto via scripting. For PCs however, the only way to change their file is to edit their .bic directly and then have them reload, normally by booting them and having them rejoin. As an alternative to booting, you can use ActivatePortal to portal the player back to the same server. This is much neater, avoids the "reusing custom content in the same sessions crashes the client" bug, and stops other players from jumping into your slot on a busy server. However, the downside of that is that you have to know the IP of the server in order to put it in the script and whenever the IP changes, you have to change the script. Not a big issue for large servers since they would have a fixed IP or a web address, but for small PWs / LAN it can be a problem.

Bioware provided a GetPCIPAddress function, but nothing for getting the IP of the server. I know nothing about programming other than NWScript, so I wouldnt know where to start with a NWNX plugin let alone getting an IP address. I imagine its quite a simple task to do; websites such as www.whatismyip.com can do it very quickly.

Anyone? Please, pretty please? Very Happy
Back to top
View user's profile Send private message
Alosynth



Joined: 06 Jan 2005
Posts: 24

PostPosted: Tue Mar 08, 2005 17:28    Post subject: Reply with quote

Could you use 'localhost' or '127.0.0.1'? I know connecting a client to a server running on the same machine rather than putting my LAN IP in, I use localhost:5212. Or does this cause the client to try and connect to their own PC when you pass it through ActivatePortal?
Back to top
View user's profile Send private message
NoMercy



Joined: 03 Jan 2005
Posts: 123
Location: UK

PostPosted: Tue Mar 08, 2005 23:41    Post subject: Reply with quote

In many ways your better off hardcoding the IP address, if you use a NAT router/cablemodem theres no way windows on it's own can tell your public IP, and you'd have to connect out to a website like whatismyip.com to get the information, and there's no guarantie there server will be running when you want to use it.

Two slightly better sites to use for automated reading:
http://checkip.dyndns.org/
http://www.showmyip.com/xml/


I don't think you'd get away with specifing 127.0.0.1, as the IP gets sent to the users machine to connect to, ideally you should try and get a static IP address for your server anyway.
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Grinning Fool



Joined: 12 Feb 2005
Posts: 264

PostPosted: Wed Mar 09, 2005 0:00    Post subject: Reply with quote

Quote:

In many ways your better off hardcoding the IP address, if you use a NAT router/cablemodem theres no way windows on it's own can tell your public IP, and you'd have to connect out to a website like whatismyip.com to get the information,

Agreed, either hardcoding, putting it in an ini file (read through a plugin), or easiest of all, toss it in a mysql/sqllite/etc database since you've presumably got connectivity to the DB already, and issue a query against the DB when needed.

Quote:
nd there's no guarantie there server will be running when you want to use it.

Very very true. And while the plugin waits for lookup web site to timeout, your entire server is locked. *scratches head, thinking* Though there are ways around that last.


My suggestion would be this:
- make a windows scheduled task that looks up the IP address (once every hour or so) and updates a record in your mysql (or whatever...) database
- When you want to use the address to create the portal, run a query database query. I can't remember the default table name in NWNX, but you could use a row in that table.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    nwnx.org Forum Index -> Windows development All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group