how to connect to server,which is running in LAN

Just starting out? Need help? Post your questions and find answers here.
Z_Exploder
User
User
Posts: 20
Joined: Wed Jul 06, 2005 7:51 am
Location: Armenia
Contact:

how to connect to server,which is running in LAN

Post by Z_Exploder »

Hi all.
I have some problems.And of course they are about client-server apps. Now description.
If i'm running my server app. on computer,which is communicated by LAN,
I don't know how to connect to server out of LAN (which IP to use ,LAN's 192.168.0.1 or which).Why i need that- because in all cyber cafes computers are communicated by LAN,and when i'm trying to run my chat cent (my own),i dont know how to connect to server,which is running in LAN from other place.
Thanks.
And about one bug:
I'm using Purebasic 3.51 and when using opennetworkconnection() ,all is good.
But some time ago i was writing PortListener-program testing which ports is opened on PC.Of course,for speed,i'm using multi - thread (each thread opens connection separately).If i'm using this function,i cant open connections more than 2000 same time,
i have tried to use winsock functions instead of opennetworkconnection()-all is working fine.
User avatar
Rings
Moderator
Moderator
Posts: 1435
Joined: Sat Apr 26, 2003 1:11 am

Re: how to connect to server,which is running in LAN

Post by Rings »

Z_Exploder wrote:...I'm using Purebasic 3.51....
update if you are a registered user of PureBasic
SPAMINATOR NR.1
Z_Exploder
User
User
Posts: 20
Joined: Wed Jul 06, 2005 7:51 am
Location: Armenia
Contact:

Post by Z_Exploder »

I can't upgrade my PB , i don't know how to do it :oops:
Now about bug i found,please try code in your PB's later versions than 3.51 8)
;On my PC this fails after 3971's opened connection (see - this is not multi threaded program,no problems with threads)
Here is code :

;When i'm using Winsock functions, all is working fine
;I think - all problem is in OpenNetworkConnection() command,there is bug
;I'm using PureBasic 3.51 , maybe this bug already fixed, i don't know
InitNetwork()
port=111 ;You can set your server's port
exit=0
n=0
Repeat
cid=OpenNetworkConnection("127.0.0.1",port)
If cid
;CloseNetworkConnection(cid) ; If i'm closing opened connection,no fails,all is working => problem is count of opened connections
n+1
Else
Debug n
exit=1
EndIf
Until exit=1
End


; ExecutableFormat=Windows
; EOF

:arrow:
Now about main question about LAN : Have you any ideas how to connect to server ,which is in LAN (i think this must work in my 3.51 :D )
Num3
PureBasic Expert
PureBasic Expert
Posts: 2812
Joined: Fri Apr 25, 2003 4:51 pm
Location: Portugal, Lisbon
Contact:

Post by Num3 »

To update, navigate to www.purbasic.com and go to the downloads tab...

Just put your email and password in the Login area and all the latest versions are there for download.
Z_Exploder
User
User
Posts: 20
Joined: Wed Jul 06, 2005 7:51 am
Location: Armenia
Contact:

Post by Z_Exploder »

Have anybody tryed code,i'll download later versions later.Now olz. test code.
What about main question ?
thefool
Always Here
Always Here
Posts: 5875
Joined: Sat Aug 30, 2003 5:58 pm
Location: Denmark

Post by thefool »

there are so much difference between the latest version and yours. Better update! [of course, if you have an unlegal old version from emule or so you cant update ;) ]
Z_Exploder
User
User
Posts: 20
Joined: Wed Jul 06, 2005 7:51 am
Location: Armenia
Contact:

Post by Z_Exploder »

I see it's very difficult to test my code,well i'm only trying to fix a bug,it's your business to test it or not .
Now what about LAN ? Maybe it's possible to use proxy servers to do this ,do you know other ways ?
dagcrack
Addict
Addict
Posts: 1868
Joined: Sun Mar 07, 2004 8:47 am
Location: Argentina
Contact:

Post by dagcrack »

:shock: Why would you use a proxy server for this?, You have a cyber coffee, all PCs should already have inet access, how you designed your application, thats not our business but I can tell you how it should be made...

Server is installed on your main PC
Client is installed on any PC with inet access which is OUT of your cyber coffee..

Now, the server connects to its "child" or Client PCs (you might share the net with a router for sure). Not the childs to the... outside client.

Once you've got it well designed, start doing small tests, dont try to add 200 features at once, because they might not even work at all. Once your core is set and working, start adding features. You've told me you want to make a type of RADMIN no?, then just follow what I said, there shouldnt be many problems. and yes, upgrade your PureBasic version. Although, you might have to modify your code in order to compile on newer versions (I'm sure, but not big things to change I guess).

Now that I'm back, you can keep on sending PMs :lol:
Cheers Z_Exploder..!
! Black holes are where God divided by zero !
My little blog!
(Not for the faint hearted!)
thefool
Always Here
Always Here
Posts: 5875
Joined: Sat Aug 30, 2003 5:58 pm
Location: Denmark

Post by thefool »

what would the difference be in connecting to a computer in LAN compared to one on the internet?
pantsonhead
User
User
Posts: 39
Joined: Fri Mar 26, 2004 1:47 pm
Location: London, UK
Contact:

diff(LAN/Internet)

Post by pantsonhead »

I guess you could use NetBios names on LAN but not internet.
Also you would have problems connecting to machine behind a gateway using DHCP/NAT.
thefool
Always Here
Always Here
Posts: 5875
Joined: Sat Aug 30, 2003 5:58 pm
Location: Denmark

Post by thefool »

exactly so its even easier on lan :)
Z_Exploder
User
User
Posts: 20
Joined: Wed Jul 06, 2005 7:51 am
Location: Armenia
Contact:

Post by Z_Exploder »

Server is installed on your main PC
Client is installed on any PC with inet access which is OUT of your cyber coffee..

Now, the server connects to its "child" or Client PCs (you might share the net with a router for sure). Not the childs to the... outside client.
I need not client in LAN,i have server in LAN,
It will be gr8,if you can say me how can connect to it (IP=? 192.168.0.7 ? hehe LAN ip is not in game)
It's important -SERVER MUST STAY IN LAN !!!
thefool
Always Here
Always Here
Posts: 5875
Joined: Sat Aug 30, 2003 5:58 pm
Location: Denmark

Post by thefool »

that is a lan ip
Z_Exploder
User
User
Posts: 20
Joined: Wed Jul 06, 2005 7:51 am
Location: Armenia
Contact:

Post by Z_Exploder »

I know,that is a lan ip,but it's not working,wheni'm trying to use it to connect
So i need other ip :D
or other ways to do it
pantsonhead
User
User
Posts: 39
Joined: Fri Mar 26, 2004 1:47 pm
Location: London, UK
Contact:

Post by pantsonhead »

I don't think you will be able to contact a server on your LAN from outside (on the internet) unless you:

a) set up the server machine as Default DMZ Server for your LAN
or
b) set up the router to send traffic for the port you use to the server machine

Obviously the machine is in a LAN using NAT because IP is 192.168.0.7
If the router is using DHCP you may also experience problems with IP address changes every time the DHCP lease expires.

Is this your LAN?
Do you have admin rights for the router at 192.168.0.1?
If not you might be a bit stuck.

PS: A quick way to see your servers internet IP is:
http://whatismyip.com
Post Reply