Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Basic Winsock sckError on Local IP:"127.0.0....." : is it XP specific?

Status
Not open for further replies.

allohamiamore

Programmer
Nov 14, 2002
4
GB
Last thread was abit vague in its heading.

I'm trying to make a local winsock connection with winsock on XP and keep getting sckError: on connection.

Is it specific with XP: ie are there any IP issues I need to address first?

I now found winsock to be working...just not connecting.
The code is fine as I've downloaded from a tutorial page.

As I'd said I'm new to this...

Can ne one help......?
 
Hi tech215 Thanks for replying:

This is the transmitter for the message. I've used a "localhostIP" before and didn't work so I just entered the IP manually. The IP was first: "127.0.0.1" and then I got onto the web so used the ISP asigned IP both of them don't work. Winsock does detect the "localhostIP" when parsed through a text beox.

If Winsock1.State <> sckClosed Then Winsock1.Close

Winsock1.RemoteHost = txtAddress.Text
Winsock1.RemotePort = 1011

Winsock1.Connect

Do Until Winsock1.State = sckConnected
DoEvents: DoEvents: DoEvents: DoEvents

If Winsock1.State = sckError Then
MsgBox &quot;Connection error!&quot;
Exit Sub
End If

Loop

The receiver code is:
when the form loads:

Winsock1.LocalPort = 1011
Winsock1.Listen

I would listen to the same port and then do a connection request method:

If Winsock1.State <> sckClosed Then Winsock1.Close
Winsock1.Accept requestID

Then try to display the data received through a textbox.

Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)

Dim strIncoming As String

Winsock1.GetData strIncoming

txtMessage.Text = strIncoming

End Sub


Thanks in advance.

 
I tried what looks like the same code you downloaded and it works fine under win98. Here's the code for the receiver I used. I used telnet as the transmitter. Let me know how you make out...

Private Sub Form_Load()
tcpServer.LocalPort = 1001
tcpServer.Listen
End Sub

Private Sub tcpServer_ConnectionRequest(ByVal requestID As Long)
If tcpServer.State <> sckClosed Then tcpServer.Close
tcpServer.Accept requestID
End Sub

Private Sub txtSendData_Change()
tcpServer.SendData txtSendData.Text
End Sub

Private Sub tcpServer_DataArrival (ByVal bytesTotal As Long)
Dim strData As String
tcpServer.GetData strData
txtOutput.Text = strData
End Sub

 
thanks dwj,

if I had a firewall running on the local machine that shouldn't affect the local sockets should it...?

I still can't get the socket to make a connection...not sure abt telnet though never used it before. I used to have Win98 and NT machine and they both worked fine.

Wondered if it was the XP settings?...Not very familiar with the ins and outs of it yet.


cheers and beers
 
Hi

Have you tried connecting using IP 127.0.0.1
If you have firewall enabled, it would filter anything referring to the IP of the network card.
 
You could try the TCP/IP forum. It looks like you're really messed up with the IP addressing.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top