Page 1 of 3

how to connect to server,which is running in LAN

Posted: Thu Aug 11, 2005 1:39 pm
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.

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

Posted: Thu Aug 11, 2005 3:24 pm
by Rings
Z_Exploder wrote:...I'm using Purebasic 3.51....
update if you are a registered user of PureBasic

Posted: Fri Aug 12, 2005 2:29 pm
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 )

Posted: Fri Aug 12, 2005 2:55 pm
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.

Posted: Sun Aug 14, 2005 11:14 am
by Z_Exploder
Have anybody tryed code,i'll download later versions later.Now olz. test code.
What about main question ?

Posted: Sun Aug 14, 2005 11:23 am
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 ;) ]

Posted: Tue Aug 16, 2005 12:45 pm
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 ?

Posted: Tue Aug 16, 2005 2:18 pm
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..!

Posted: Tue Aug 16, 2005 3:06 pm
by thefool
what would the difference be in connecting to a computer in LAN compared to one on the internet?

diff(LAN/Internet)

Posted: Tue Aug 16, 2005 3:48 pm
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.

Posted: Tue Aug 16, 2005 4:16 pm
by thefool
exactly so its even easier on lan :)

Posted: Tue Aug 16, 2005 4:20 pm
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 !!!

Posted: Tue Aug 16, 2005 4:21 pm
by thefool
that is a lan ip

Posted: Tue Aug 16, 2005 4:54 pm
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

Posted: Tue Aug 16, 2005 5:00 pm
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