how to connect to server,which is running in LAN
-
- User
- Posts: 20
- Joined: Wed Jul 06, 2005 7:51 am
- Location: Armenia
- Contact:
how to connect to server,which is running in LAN
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.
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
update if you are a registered user of PureBasicZ_Exploder wrote:...I'm using Purebasic 3.51....
SPAMINATOR NR.1
-
- User
- Posts: 20
- Joined: Wed Jul 06, 2005 7:51 am
- Location: Armenia
- Contact:
I can't upgrade my PB , i don't know how to do it
Now about bug i found,please try code in your PB's later versions than 3.51
;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
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
)

Now about bug i found,please try code in your PB's later versions than 3.51

;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

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

-
- PureBasic Expert
- Posts: 2812
- Joined: Fri Apr 25, 2003 4:51 pm
- Location: Portugal, Lisbon
- Contact:
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.
Just put your email and password in the Login area and all the latest versions are there for download.
-
- User
- Posts: 20
- Joined: Wed Jul 06, 2005 7:51 am
- Location: Armenia
- Contact:
-
- User
- Posts: 20
- Joined: Wed Jul 06, 2005 7:51 am
- Location: Armenia
- Contact:

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

Cheers Z_Exploder..!
-
- User
- Posts: 39
- Joined: Fri Mar 26, 2004 1:47 pm
- Location: London, UK
- Contact:
diff(LAN/Internet)
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.
Also you would have problems connecting to machine behind a gateway using DHCP/NAT.
-
- User
- Posts: 20
- Joined: Wed Jul 06, 2005 7:51 am
- Location: Armenia
- Contact:
I need not client in LAN,i have server in LAN,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.
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 !!!
-
- User
- Posts: 20
- Joined: Wed Jul 06, 2005 7:51 am
- Location: Armenia
- Contact:
-
- User
- Posts: 39
- Joined: Fri Mar 26, 2004 1:47 pm
- Location: London, UK
- Contact:
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
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