Private Sub connect_Click()
Winsock.RemoteHost = ipadd
Winsock.RemotePort = 10101
Winsock.connect
End Sub

I'm pertty sure the problem is on line two the ipadd if thats supposed to be ipadd or if its supposed ot have something else added.

ok, is ipadd a variable that contains an IP Address or host name?
you could try removing "ipadd" and replacing it with an actual IP or host:

Private Sub connect_Click()
Winsock.RemoteHost = "google.com"
Winsock.RemotePort = 10101
Winsock.connect
End Sub

I'm fairly certain that google will have 10101 (port number) blocked... but I'm pretty sure it will have 80 open ;)

ipadd is an text box that you fill in the ip address and press connect, then it connects. So you don't have just one ip you can connect to (its a direct connect program)

oh, no problem then, try with this:

Private Sub connect_Click()
Winsock.RemoteHost = ipadd.text
Winsock.RemotePort = 10101
Winsock.connect
End Sub

Awww, thx i knew there was a small peice that i couldn't remember lol, im still a newbie to vb, most basic things i'm still trying to catch on to :p

No problemo, If you need any further help, especially with the project your currently undertaking, just let me know. I am working on a project of a very similar nature....

O poo, now it says that the address is in use. Heres the lowdown. The chat program is created to serv OR connect, all in one app. Now it may be a winsock problem i cant see but i dont know. I have to folders with the EXACT same form. I run one and press the host button, then run another enter in the ip "127.0.0.1" and it gives me a runtime error and says "Address in use". Its in the same code that i originaly poisted just on the 4'th line "winsock.Connect".

If one is a listening socket, and one is a client socket, then it might work. I'm not so sure that windows is going to like the idea of you trying to use 10101 for both listening and trying to connect on though. If it's the same code though, it should be just 2 programs trying to connect to the same port.... I usually get that same error when I try to have 2 server sockets (sockets that accept a connecton) on the same port and IP address.

So should i make 2 seperate programs? or should i use two seperate ports?

The thing is this.... 1 winsock control needs to be a "listening" socket, and 1 needs to be a client socket. Here, read this mini-tutorial about winsock, and it will give you a better understanding. Basically, 1 socket needs to say "ok, I'm gonna listen and if you try to connect, I will accept your connection". The other socket needs to say "hey, I'm gonna try to make a connection to you". Here is the tutorial:

http://www.devx.com/vb2themax/Article/19879

Keep in mind, that if you make them the same program, then that project will need to have 2 sockets... one that listens (server socket) and 1 that tries to make a connection (client socket).

Another issue has arisen
Private Sub send_Click()
Winsock.SendData txtsend.Text
DoEvents
txtdisplay.Text = txtdisplay.Text & vbCrLf & txtsend.Text
txtsend.Text = ""
End Sub
I need it so that everytime i finish a message it goes to the next line, and print on that line, name ill handle later.

Oh lol, i figured that part out >.> cant get one program to connect to itself, had to run two programs :p but that works, i just need to get it so that when im serving and then press connect it auto tuirns off the serving connection and starts the conecting connection, or vise versa.

I don't know exactly what you mean, but I'm guessing that you want to set the "multi-line" property of the textbox, so that it can have more than 1 line of text in it right?

I'm not sure I know what you mean about having the socket change over. There are only 2 kinds of socket. A Listener, and A Client, you can't have 1 socket do both. Plain and simple. You can't change in the middle, either. Once a client makes a connection to the server, the server has to remain that type of socket, and the client has to remain it's type of socket. Once you are connected, however, you can send data back and forth from the server socket to the client and vice versa.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.