PDA

Click to See Complete Forum and Search --> : Client not Connecting...


Osiris
Mar 4th, 2005, 09:29 AM
Hi, I have a question reguarding winsock connection.

In some cases, when certain people try to connect to my server they never reach or make a connection request on my side yet on their side it says that it didn't find the server.

I use www.no-ip.com so they always have my current IP address, also i've tried editing my no-ip.com account so that they connect to other reasonable IPs that I currently have... and still they are not able to connect to me.
Is there a reason why they cannot reach/find me and can this be fixed?

Thanx

Pino
Mar 4th, 2005, 10:12 AM
Hi, I have a question reguarding winsock connection.

In some cases, when certain people try to connect to my server they never reach or make a connection request on my side yet on their side it says that it didn't find the server.

I use www.no-ip.com so they always have my current IP address, also i've tried editing my no-ip.com account so that they connect to other reasonable IPs that I currently have... and still they are not able to connect to me.
Is there a reason why they cannot reach/find me and can this be fixed?

Thanx

Wierd, i think we will need to know more specifics, could i see the server listening code and the client connection code?

also your hardware set up are you behind a router?

Osiris
Mar 4th, 2005, 03:30 PM
Wierd, i think we will need to know more specifics, could i see the server listening code and the client connection code?

Well, there is really no client code, the client is basically a web browser from another computer and I am listening through port 80. When ever I connect to my no-ip.com hostname, I am able to access my server, so the server code seems to work fine...


Private Sub wsock_ConnectionRequest(ByVal requestID As Long)
wsock.Close
wsock.Accept requestID

If wsock.State = sckConnected Then
Logg "Connection request from " & wsock.RemoteHostIP
End If
End Sub


I am not sure which section of the server code you might want to see?


also your hardware set up are you behind a router?

No, I don't have a router, but I use DSL and a firewall, but since I'm listening through port 80 I thought I might not have any problems...

Pino
Mar 5th, 2005, 05:39 AM
Well, there is really no client code, the client is basically a web browser from another computer and I am listening through port 80. When ever I connect to my no-ip.com hostname, I am able to access my server, so the server code seems to work fine...


Private Sub wsock_ConnectionRequest(ByVal requestID As Long)
wsock.Close
wsock.Accept requestID

If wsock.State = sckConnected Then
Logg "Connection request from " & wsock.RemoteHostIP
End If
End Sub


I am not sure which section of the server code you might want to see?



No, I don't have a router, but I use DSL and a firewall, but since I'm listening through port 80 I thought I might not have any problems...

Whats the problem then? If you can still connesct? (sorry if you've allready mentioned it)

The code looks fine but you do relise that will noly work for one client? You need to set up mulitple connections if you wnat more than one client to connect.

Pino

Osiris
Mar 5th, 2005, 01:11 PM
Whats the problem then? If you can still connesct? (sorry if you've allready mentioned it)

The code looks fine but you do relise that will noly work for one client? You need to set up mulitple connections if you wnat more than one client to connect.

Pino

Yes I know, it will only work for one client now... but I am just testing it with one client only.

Well, when I try to connect from my computer to my computer, the server detects that I am connecting to it.
Also when I connect from a computer in the same network as the server, the server detects that I am connecting.
But when I ask a friend which lives far away, lets say, canada... (im in the u.s.), they never could connect and my server never displays their connection meaning they never reached it. (I am listening through port 80 by the way....)

Pino
Mar 5th, 2005, 01:19 PM
Yes I know, it will only work for one client now... but I am just testing it with one client only.

Well, when I try to connect from my computer to my computer, the server detects that I am connecting to it.
Also when I connect from a computer in the same network as the server, the server detects that I am connecting.
But when I ask a friend which lives far away, lets say, canada... (im in the u.s.), they never could connect and my server never displays their connection meaning they never reached it. (I am listening through port 80 by the way....)

Thats very wierd, whne you say network, how do your network acces the internet is it througha switch or router of some kind?

Osiris
Mar 5th, 2005, 02:54 PM
Thats very wierd, whne you say network, how do your network acces the internet is it througha switch or router of some kind?

Well, there are two places where I have tried this server, school and at home.

At school, I log in on one computer and start the server, and on another computer I open a web browser and try to connect to the server (I would have updated my no-ip account before all this though) and it works perfect.
Although I have never asked someone to access my server from outside my school's network.

When at home (I only have one computer connected with DSL), I start the server and connect to it from the same computer it works. But when I ask a friend to connect to it, they never seem to to find the server and my server doesn't display that they have reached it either.

What is weird though, is that if I make the server listen through a different port, lets say 1900... and on the other side someone else is trying to connect with an application using port 1900 as well, it is able to connect. I think I am only having trouble with people connecting to me through port 80.

Pino
Mar 5th, 2005, 02:59 PM
Well, there are two places where I have tried this server, school and at home.

At school, I log in on one computer and start the server, and on another computer I open a web browser and try to connect to the server (I would have updated my no-ip account before all this though) and it works perfect.
Although I have never asked someone to access my server from outside my school's network.

When at home (I only have one computer connected with DSL), I start the server and connect to it from the same computer it works. But when I ask a friend to connect to it, they never seem to to find the server and my server doesn't display that they have reached it either.

What is weird though, is that if I make the server listen through a different port, lets say 1900... and on the other side someone else is trying to connect with an application using port 1900 as well, it is able to connect. I think I am only having trouble with people connecting to me through port 80.


Yes i have a feeling what is going on but i'm not 100% could i see the app? source? i can test it out then.

Osiris
Mar 5th, 2005, 03:53 PM
Yes i have a feeling what is going on but i'm not 100% could i see the app? source? i can test it out then.

Logg just records a given text into a textbox.

The winsock properties for wsock(the winsock variable name) are:
LocalPort : 80
Protocol: 0-sckTCPProtocol
RemoteHost:
RemotePort: 0


Private Sub Form_Load()
Center Me
Logg "Starting server..."
wsock.Listen
Logg "Server running..."
Logg "Listening through Local Port : " & wsock.LocalPort
Logg "Current IP Adress : " & wsock.LocalIP
End Sub



Private Sub wsock_ConnectionRequest(ByVal requestID As Long) wsock.Close
wsock.Accept requestID

If wsock.State = sckConnected Then
Logg "Connection request from " & wsock.RemoteHostIP
End If
End Sub



Private Sub wsock_DataArrival(ByVal bytesTotal As Long)
Dim dat_in$, v As Variant

wsock.GetData dat_in

Logg "-------- http in --------"
Logg dat_in
Logg "-------- http end --------"

tdayname = Format(Now, "dddd")
tdayname = Left(tdayname, 3)
tdaynum = Format(Now, "dd") & " "
tmonth = Format(Now, "mmm") & " "
tyear = Format(Now, "yyyy") & " "
thr = Format(Now, "hh")
thr = Val(thr) + 5
thr = thr & ":"
tmn = Format(Now, "mm") & ":"
tsec = Format(Now, "ss") & " GMT"

ttime = thr & tmn & tsec & Chr(13) & Chr(10)
sdate = tdayname & ", " & tdaynum & tmonth & tyear & ttime

stitle = "HTTP/1.1 100 Continue" & Chr(13) & Chr(10)
sheader1 = "Date: " & sdate & Chr(13) & Chr(10)
sheader2 = "Accept-Language: en-us" & Chr(13) & Chr(10)
sheader3 = "Accept-Encoding: gzip, deflate" & Chr(13) & Chr(10) & Chr(13) & Chr(10)

sEnvelope = stitle & sheader1 '& sheader2 & sheader3

Logg "-------- http out --------"
Logg "" & sEnvelope
Logg "-------- http end --------"

wsock.SendData sEnvelope & "<html><body bgcolor=#FFFF00><center><table border=3> <tr><th colspan=2>Wrong Way Airlines</th></tr><tr> <th>03-03-05<th>Come back soon , this is under construction!</th> </tr> </table></center><br><br>Neat-o Server 1.o <br><br> </body></html>"
pause 1
wsock.Close

Do
DoEvents
Loop Until wsock.State = sckClosed
wsock.Listen

End Sub



Private Sub wsock_Close()
Logg "Connection closed from " & wsock.RemoteHostIP
pause 1
Timer1.Interval = 1
End Sub

Osiris
Mar 5th, 2005, 04:15 PM
Sorry to double post but I decided to zip my project and link the source files.

Server Source Files (http://web.njit.edu/~oro2/vbforums.zip)

Pino
Mar 8th, 2005, 04:44 AM
Sorry to double post but I decided to zip my project and link the source files.

Server Source Files (http://web.njit.edu/~oro2/vbforums.zip)

No problem, its best you posted the files :)

I can figure out whats wrong, it works when i do it from my own pc running server on my own pc....

Have you managed to solve this?

Osiris
Mar 8th, 2005, 11:31 AM
No problem, its best you posted the files :)

I can figure out whats wrong, it works when i do it from my own pc running server on my own pc....

Have you managed to solve this?

Yeah, it works fine when I connect to myself from my own computer too... but I still haven't figured out why other people can't to connect to me. I really haven't had enough time to play around with this as to when I started but if I am able to figure it out, I'll post it here.