Hello.
I made a winsock server and client program. When i test it on my PC on localport(127.0.0.1) it works perfectly, but when i test it with my friend over internet it wont work. When i send a message it gets some error. No connectivity. So i guess we are not connected lol. So my question is. Is it possible that firewall is blocking client from connecting to a server or ther is a problem in code.
Here is the code for server
.... and here is for clientCode:Private Sub Form_Load() Winsock1.LocalPort = 80 Winsock1.Listen End Sub Private Sub TxtPoruka_KeyPress(KeyAscii As Integer) On Error GoTo noconnection If KeyAscii = 13 Then Dim poruka1 As String poruka1 = "[SERVER]: " + TxtPoruka Winsock1.SendData poruka1 txtEkran.Text = txtEkran + poruka1 + vbCrLf TxtPoruka.Text = "" End If noconnection: End Sub Private Sub Winsock1_ConnectionRequest(ByVal requestID As Long) Winsock1.Close Winsock1.Accept requestID End Sub Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long) Dim PrimljenaPoruka As String Winsock1.GetData PrimljenaPoruka txtEkran.Text = txtEkran + PrimljenaPoruka + vbCrLf End Sub
thnx in advance.Code:Private Sub mnuIzlaz_Click() Unload Me End Sub Private Sub mnuSpojiSe_Click() ip = InputBox("Unesite IP adresu racunala na koje se zelite spojiti", ip) nadimak = InputBox("Unesite zeljeni nadimak", nadimak) Winsock1.Close Winsock1.Connect ip, 80 End Sub Private Sub TxtPoruka_KeyPress(KeyAscii As Integer) On Error GoTo noconnection If KeyAscii = 13 Then Dim poruka1 As String poruka1 = "[" + nadimak + "]: " + TxtPoruka Winsock1.SendData poruka1 txtEkran.Text = txtEkran + poruka1 + vbCrLf TxtPoruka.Text = "" noconnection: End If End Sub Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long) Dim poruka As String Winsock1.GetData poruka txtEkran.Text = txtEkran + poruka + vbCrLf End Sub


Reply With Quote
