Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[EO] Static IP && Port


The New World
 Share

Recommended Posts

This is to ensure that the client can only connect a hard coded IP Address && Port. It's a fairly simple tutorial.

This will all be done via Client-Side.

In modClientTCP, in _sub TcpInit_, find:

```
' connect
frmMain.Socket.RemoteHost = Options.IP
frmMain.Socket.RemotePort = Options.Port

```
Change Options.IP, and Options.Port to match your server's IP Address, and Port.

Next!

In modDatabase, within _Public Sub SaveOptions()_, find:

```
Call PutVar(fileName, "Options", "IP", Options.IP)
Call PutVar(fileName, "Options", "Port", Str(Options.Port))

```
Delete both of these lines.

Next in modDatabase, within _Public Sub LoadOptions()_, find:

```
Options.IP = "127.0.0.1"
Options.Port = 7001

```
Delete both of these lines.

And within the same module and sub, find:

```
Options.IP = GetVar(fileName, "Options", "IP")
Options.Port = Val(GetVar(fileName, "Options", "Port"))

```
Omit these lines as well. (Omit means delete or remove. >_>)

Now in your client folder, open up Config.ini, and delete the IP= and Port= variables from the file so that it now looks like this:

```
[Options]
Game_Name=
Username=
Password=
SavePass=
MenuMusic=
Music= 1
Sound= 1
Debug= 0

```
All done! :)  :bstar:
Link to comment
Share on other sites

This is all fine until your ISP cycles your IP and all the clients you distributed no longer have a working server IP to point toward.

I would ammend this tutorial with a No-IP addition (www.no-ip.com)  it is alot easier to manage a client you have distributed that contains a yourserver.serveftp assigned IP address rather than a static one that requires you to tell everyone to manually update their clients when they try to log in one day and realise they cant anymore - also would save you distributing a new client on every IP change.
Link to comment
Share on other sites

@Devo:

> This is all fine until your ISP cycles your IP and all the clients you distributed no longer have a working server IP to point toward.
>
> I would ammend this tutorial with a No-IP addition (www.no-ip.com)  it is alot easier to manage a client you have distributed that contains a yourserver.serveftp assigned IP address rather than a static one that requires you to tell everyone to manually update their clients when they try to log in one day and realise they cant anymore - also would save you distributing a new client on every IP change.

Simple enough, and well noted. Thanks devogen. I kind of figured they'd be using a no-ip by default in the first place, these external IP addresses are hideous. :P
Link to comment
Share on other sites

  • 4 months later...
dont know if it would be concidered the BEST idea… but i was tryna make option buttons out of that... and allow checking one to choose which IP u connect to... ones thats coded in using that method... (between 2 options) or using the ini ip... i was tryna post like this

If frmMenu.optINI = 1 Then
(ini IP)
(ini PORT)
Else
"127.0.0.1"
7001
If frmMenu.optINI = 0 Then
End If
End If

If frmMenu.optLocalIP = 1 Then
(ip that u need to connect to my pc)
7001
If frmMenu.LocalIP = 0 Then
End If
End If

and so on..(obviously i didnt leave it that bear... i pu the actual stuff that was needed ... i didnt leave just ip and port there like it was gunna do anything >.>
'frmMain.Socket.RemoteHost = Options.IP
    'frmMain.Socket.RemotePort = Options.Port
that part...

Whenever i try this it doesnt work... obviously im still kinda noob and its probly not the right thing to do but how would i make that work?
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...