Mirage Source

Free ORPG making software.
It is currently Sat Apr 20, 2024 3:21 am

All times are UTC


Forum rules


Make sure your tutorials are kept up to date with the latest MS4 releases.



Post new topic Reply to topic  [ 1668 posts ]  Go to page 1, 2, 3, 4, 5 ... 67  Next
Author Message
PostPosted: Fri Apr 24, 2009 1:33 am 
Offline
Persistant Poster
User avatar

Joined: Thu Mar 29, 2007 10:30 pm
Posts: 1510
Location: Virginia, USA
Google Talk: hpmccloud@gmail.com
So, I just wrote up my own fine ass function for getting your actual IP. At first it was just 1 line of code, and I'm sure you've seen code using INet before to get your actual IP...but none like this, good sir!

First, open your server:

In modGlobals, add this:

Code:
Public ACTUAL_IP As String
Public IP_Source As String


Then in Sub UpdateCaption, replace the:

Code:
frmServer.Socket(0).LocalIP


With:

Code:
ACTUAL_IP


Then in InitServer (before the final SetStatus message) add this:

Code:
IP_Source = "org"
ACTUAL_IP = GetActualServerIP


What I did with the IP_Source is basically let you choose between using whatismyip.com or whatismyip.org (sometimes one's down). Either make IP_Source = "com" or "org". In my engine I have this load from an INI file...but doing an INI file is a totally different tutorial.

Then go to Project > Components. Look for Microsoft Internet Transfer Control 6.0 and check it and click OK.

Now open frmServer and add the INet control anywhere you want and make sure it's named: INet. Then click on your new INet control and in the properties box make sure Index is set to 0 (it's blank by default).

And...here's the magic itself. Add this to modGeneral (or any other module is fine):

Code:
''''''''''''''''''''''''''''''''''''''''''''
' Function written from scratch by: GIAKEN '
''''''''''''''''''''''''''''''''''''''''''''
Public Function GetActualServerIP() As String
Dim RetryValue As Long

    Load frmServer.INet(1)
   
Retry:
   
    'after 2 seconds time the request out
    frmServer.INet(RetryValue).RequestTimeout = 2
   
    Select Case IP_Source
        Case "org"
            Call SetStatus("Retrieving actual IP from whatismyip.org...")
           
            On Error Resume Next
            GetActualServerIP = frmServer.INet(RetryValue).OpenURL("http://whatismyip.org", icString)
            On Error GoTo ErrHandler
           
        Case "com"
            Call SetStatus("Retrieving actual IP from whatismyip.com...")
           
            On Error Resume Next
            GetActualServerIP = frmServer.INet(RetryValue).OpenURL("http://whatismyip.com/automation/n09230945.asp", icString)
            On Error GoTo ErrHandler
           
    End Select
   
    'if the IP is blank, then handle it as an error
    If LenB(GetActualServerIP) = 0 Then GoTo ErrHandler
   
    Call SetStatus("Successfully retrieved actual IP.")
    Exit Function

ErrHandler:

    'clear the RTE error just in case so we can properly continue
    Err.Clear
   
    Call SetStatus("Failed to retrieve actual IP address: timed out.")
   
    frmServer.INet(RetryValue).Cancel
    RetryValue = RetryValue + 1
   
    If RetryValue <= 1 Then
        ' since we failed, we'll retry with another method
        If IP_Source = "org" Then
            IP_Source = "com"
        Else
            IP_Source = "org"
        End If
        GoTo Retry
    End If
   
    'couldn't get the actual IP, so just use the local one...
    GetActualServerIP = frmServer.Socket(0).LocalIP
   
End Function


The reason I had to make the INet an array was because when INet times out it requests a time out when you try again instantly...so I just made Inet 0 and 1 so if 0 fails 1 can attempt to back it up.

_________________
Nean wrote:
Yes harold. Give it to me.

Image
Image


Last edited by GIAKEN on Mon May 11, 2009 3:38 am, edited 4 times in total.

Top
 Profile  
 
PostPosted: Fri Apr 24, 2009 1:47 am 
Offline
Persistant Poster
User avatar

Joined: Thu Jul 24, 2008 6:42 am
Posts: 703
Google Talk: infectiousbyte@gmail.com
Really buggy, I don't recommend using this way. Too slow...


Just kidding GIAKEN, it looks good.

_________________
Image
GIAKEN wrote:
Since I'm into men, not women

GIAKEN wrote:
I can't take these huge penises anymore! All that's left is shame! And blood


Top
 Profile  
 
PostPosted: Fri Apr 24, 2009 10:52 pm 
Offline
Persistant Poster
User avatar

Joined: Thu Mar 29, 2007 10:30 pm
Posts: 1510
Location: Virginia, USA
Google Talk: hpmccloud@gmail.com
Anybody having any problems?

_________________
Nean wrote:
Yes harold. Give it to me.

Image
Image


Top
 Profile  
 
PostPosted: Fri Apr 24, 2009 11:07 pm 
Offline
Regular
User avatar

Joined: Tue Jun 03, 2008 6:22 pm
Posts: 50
GIAKEN wrote:
Anybody having any problems?


Worked fine for me, Thank you. :)


Top
 Profile  
 
PostPosted: Sat Apr 25, 2009 11:28 am 
Offline
Persistant Poster
User avatar

Joined: Thu Mar 29, 2007 10:30 pm
Posts: 1510
Location: Virginia, USA
Google Talk: hpmccloud@gmail.com
You're welcome :D

_________________
Nean wrote:
Yes harold. Give it to me.

Image
Image


Top
 Profile  
 
PostPosted: Mon May 11, 2009 3:40 am 
Offline
Persistant Poster
User avatar

Joined: Thu Mar 29, 2007 10:30 pm
Posts: 1510
Location: Virginia, USA
Google Talk: hpmccloud@gmail.com
Just worked on the GetActualServerIP function, redoing the error handling. (it was bugging if it timed out twice)

_________________
Nean wrote:
Yes harold. Give it to me.

Image
Image


Top
 Profile  
 
PostPosted: Wed Dec 01, 2021 8:54 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 479842
http://audiobookkeeper.ruhttp://cottagenet.ruhttp://eyesvision.ruhttp://eyesvisions.comhttp://factoringfee.ruhttp://filmzones.ruhttp://gadwall.ruhttp://gaffertape.ruhttp://gageboard.ruhttp://gagrule.ruhttp://gallduct.ruhttp://galvanometric.ruhttp://gangforeman.ruhttp://gangwayplatform.ruhttp://garbagechute.ruhttp://gardeningleave.ruhttp://gascautery.ruhttp://gashbucket.ruhttp://gasreturn.ruhttp://gatedsweep.ruhttp://gaugemodel.ruhttp://gaussianfilter.ruhttp://gearpitchdiameter.ru
http://geartreating.ruhttp://generalizedanalysis.ruhttp://generalprovisions.ruhttp://geophysicalprobe.ruhttp://geriatricnurse.ruhttp://getintoaflap.ruhttp://getthebounce.ruhttp://habeascorpus.ruhttp://habituate.ruhttp://hackedbolt.ruhttp://hackworker.ruhttp://hadronicannihilation.ruhttp://haemagglutinin.ruhttp://hailsquall.ruhttp://hairysphere.ruhttp://halforderfringe.ruhttp://halfsiblings.ruhttp://hallofresidence.ruhttp://haltstate.ruhttp://handcoding.ruhttp://handportedhead.ruhttp://handradar.ruhttp://handsfreetelephone.ru
http://hangonpart.ruhttp://haphazardwinding.ruhttp://hardalloyteeth.ruhttp://hardasiron.ruhttp://hardenedconcrete.ruhttp://harmonicinteraction.ruhttp://hartlaubgoose.ruhttp://hatchholddown.ruhttp://haveafinetime.ruhttp://hazardousatmosphere.ruhttp://headregulator.ruhttp://heartofgold.ruhttp://heatageingresistance.ruhttp://heatinggas.ruhttp://heavydutymetalcutting.ruhttp://jacketedwall.ruhttp://japanesecedar.ruhttp://jibtypecrane.ruhttp://jobabandonment.ruhttp://jobstress.ruhttp://jogformation.ruhttp://jointcapsule.ruhttp://jointsealingmaterial.ru
http://journallubricator.ruhttp://juicecatcher.ruhttp://junctionofchannels.ruhttp://justiciablehomicide.ruhttp://juxtapositiontwin.ruhttp://kaposidisease.ruhttp://keepagoodoffing.ruhttp://keepsmthinhand.ruhttp://kentishglory.ruhttp://kerbweight.ruhttp://kerrrotation.ruhttp://keymanassurance.ruhttp://keyserum.ruhttp://kickplate.ruhttp://killthefattedcalf.ruhttp://kilowattsecond.ruhttp://kingweakfish.ruhttp://kinozones.ruhttp://kleinbottle.ruhttp://kneejoint.ruhttp://knifesethouse.ruhttp://knockonatom.ruhttp://knowledgestate.ru
http://kondoferromagnet.ruhttp://labeledgraph.ruhttp://laborracket.ruhttp://labourearnings.ruhttp://labourleasing.ruhttp://laburnumtree.ruhttp://lacingcourse.ruhttp://lacrimalpoint.ruhttp://lactogenicfactor.ruhttp://lacunarycoefficient.ruhttp://ladletreatediron.ruhttp://laggingload.ruhttp://laissezaller.ruhttp://lambdatransition.ruhttp://laminatedmaterial.ruhttp://lammasshoot.ruhttp://lamphouse.ruhttp://lancecorporal.ruhttp://lancingdie.ruhttp://landingdoor.ruhttp://landmarksensor.ruhttp://landreform.ruhttp://landuseratio.ru
http://languagelaboratory.ruhttp://largeheart.ruhttp://lasercalibration.ruhttp://laserlens.ruhttp://laserpulse.ruhttp://laterevent.ruhttp://latrinesergeant.ruhttp://layabout.ruhttp://leadcoating.ruhttp://leadingfirm.ruhttp://learningcurve.ruhttp://leaveword.ruhttp://machinesensible.ruhttp://magneticequator.ruhttp://magnetotelluricfield.ruhttp://mailinghouse.ruhttp://majorconcern.ruhttp://mammasdarling.ruhttp://managerialstaff.ruhttp://manipulatinghand.ruhttp://manualchoke.ruhttp://medinfobooks.ruhttp://mp3lists.ru
http://nameresolution.ruhttp://naphtheneseries.ruhttp://narrowmouthed.ruhttp://nationalcensus.ruhttp://naturalfunctor.ruhttp://navelseed.ruhttp://neatplaster.ruhttp://necroticcaries.ruhttp://negativefibration.ruhttp://neighbouringrights.ruhttp://objectmodule.ruhttp://observationballoon.ruhttp://obstructivepatent.ruhttp://oceanmining.ruhttp://octupolephonon.ruhttp://offlinesystem.ruhttp://offsetholder.ruhttp://olibanumresinoid.ruhttp://onesticket.ruhttp://packedspheres.ruhttp://pagingterminal.ruhttp://palatinebones.ruhttp://palmberry.ru
http://papercoating.ruhttp://paraconvexgroup.ruhttp://parasolmonoplane.ruhttp://parkingbrake.ruhttp://partfamily.ruhttp://partialmajorant.ruhttp://quadrupleworm.ruhttp://qualitybooster.ruhttp://quasimoney.ruhttp://quenchedspark.ruhttp://quodrecuperet.ruhttp://rabbetledge.ruhttp://radialchaser.ruhttp://radiationestimator.ruhttp://railwaybridge.ruhttp://randomcoloration.ruhttp://rapidgrowth.ruhttp://rattlesnakemaster.ruhttp://reachthroughregion.ruhttp://readingmagnifier.ruhttp://rearchain.ruhttp://recessioncone.ruhttp://recordedassignment.ru
http://rectifiersubstation.ruhttp://redemptionvalue.ruhttp://reducingflange.ruhttp://referenceantigen.ruhttp://regeneratedprotein.ruhttp://reinvestmentplan.ruhttp://safedrilling.ruhttp://sagprofile.ruhttp://salestypelease.ruhttp://samplinginterval.ruhttp://satellitehydrology.ruhttp://scarcecommodity.ruhttp://scrapermat.ruhttp://screwingunit.ruhttp://seawaterpump.ruhttp://secondaryblock.ruhttp://secularclergy.ruhttp://seismicefficiency.ruhttp://selectivediffuser.ruинфоhttp://semifinishmachining.ruhttp://spicetrade.ruhttp://spysale.ru
http://stungun.ruhttp://tacticaldiameter.ruhttp://tailstockcenter.ruhttp://tamecurve.ruhttp://tapecorrection.ruhttp://tappingchuck.rutaskreasoning.ruhttp://technicalgrade.ruhttp://telangiectaticlipoma.ruhttp://telescopicdamper.ruсайтhttp://temperedmeasure.ruhttp://tenementbuilding.rutuchkashttp://ultramaficrock.ruhttp://ultraviolettesting.ru


Top
 Profile  
 
PostPosted: Tue Jan 04, 2022 11:23 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 479842
Econ


Top
 Profile  
 
PostPosted: Tue Jan 04, 2022 11:24 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 479842
94.1


Top
 Profile  
 
PostPosted: Tue Jan 04, 2022 11:25 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 479842
Bett


Top
 Profile  
 
PostPosted: Tue Jan 04, 2022 11:27 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 479842
Bett


Top
 Profile  
 
PostPosted: Tue Jan 04, 2022 11:28 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 479842
Arth


Top
 Profile  
 
PostPosted: Tue Jan 04, 2022 11:29 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 479842
Donn


Top
 Profile  
 
PostPosted: Tue Jan 04, 2022 11:30 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 479842
Sear


Top
 Profile  
 
PostPosted: Tue Jan 04, 2022 11:31 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 479842
XVII


Top
 Profile  
 
PostPosted: Tue Jan 04, 2022 11:32 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 479842
WCNo


Top
 Profile  
 
PostPosted: Tue Jan 04, 2022 11:33 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 479842
Adri


Top
 Profile  
 
PostPosted: Tue Jan 04, 2022 11:34 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 479842
Meta


Top
 Profile  
 
PostPosted: Tue Jan 04, 2022 11:35 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 479842
Cris


Top
 Profile  
 
PostPosted: Tue Jan 04, 2022 11:37 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 479842
lass


Top
 Profile  
 
PostPosted: Tue Jan 04, 2022 11:38 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 479842
Spor


Top
 Profile  
 
PostPosted: Tue Jan 04, 2022 11:39 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 479842
Flam


Top
 Profile  
 
PostPosted: Tue Jan 04, 2022 11:40 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 479842
Ever


Top
 Profile  
 
PostPosted: Tue Jan 04, 2022 11:41 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 479842
Brot


Top
 Profile  
 
PostPosted: Tue Jan 04, 2022 11:42 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 479842
Keny


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1668 posts ]  Go to page 1, 2, 3, 4, 5 ... 67  Next

All times are UTC


Who is online

Users browsing this forum: wanai and 17 guests


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 post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group