Hi guy i have asked alot of questions on here and got ace help from some member so i have decided to make a VbWire live chat app i also think i will add user file transfer aswell as some streaming music/radio and meaby video streaming using win mediaplayer meaby have some live cam feed or summin forstly i need help
So here is my problem i have the clients connect to the server and all that but now i am ading a login forum so when u type your name in to text box1 it reads the name when u send a message and it puts EG. Anton2k: Hello like that i have the code here for doing that here it is
Sock.SendData(txtName.Text & ":" & txtSend.Text)
ok as you can see it sends the txtName witch the : then the contents of the message witch u type in textbox2.
So, what i need to do is get the user to see their name when thay type and send a message and and i also have to get it reading their name from form1
Thanks in advance i will keep looking at this thred reguraly to day thanks for looking
what i mean is i want the client to see there name in the text box when thay type u know like anton2k: what i write here i want the user to see that when i do this no were thay actualy type were thay type i will display the message thay are about to send but there name will be reading off a text box in form 1 i also dont know how to read off the text box here is what code i am using right now
Private Sub txtSend_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtSend.KeyPress
If Asc(e.KeyChar) = 13 Then
So if I understand you correctly...whenever client A sends a chat message, everyone else see's the message like so: Client A: Hello everybody
But client A himself, does not see his own name before the message? If so, append the text to Txtarrive like this instead of what you're currently doing:
Thanks works gr8 no wi have 1 big problem lol the source i am working from is server to client only so lik 1 on 1 i want unlimited on 1 u kno wlike not just 1 person can use t losts of peoplr can i think its server side like the server is rejection some other connections or summin i duno here i am gona try and work it out ill post it as an atachment. thanks for your help
Could you add some code to filter out anyone using text-speak?
Sorry dont get what u mean i have though my problem over all i need now is to get the server to alow more clients to connect to it i dont know how to do that
and would this be server side or client or both lol im Stuck!!
Yea thats were i got my ciode from well i got the code from the cod ebank under tcp basic cuminication i cant see in that thread the part that lets multipl user connect to the server
try using the chat program we used in our visual basic class at school.
its really basic n easy to edit. only problem i had with it is it doesnt search for ipadresses automaticly.
The code in the thread in my signature does allow for several clients to be connected to the server at once, if you look at the doListen subroutine:
VB.NET Code:
Private Sub doListen()
Dim incomingClient As System.Net.Sockets.TcpClient
Do
incomingClient = listener.AcceptTcpClient 'Accept the incoming connection. This is a blocking method so execution will halt here until someone tries to connect.
Dim connClient As New ConnectedClient(incomingClient, Me) 'Create a new instance of ConnectedClient (check its constructor to see whats happening now).
ok i think i see how it work but error ok so i have this
Private Sub frmServer_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim incomingClient As System.Net.Sockets.TcpClient
incomingClient = Listener.AcceptTcpClient
Sock.LocalPort = 2909
Sock.Listen()
ServerAcciones.Items.Add("Server is listening...")
End Sub
Says Listner is not declaired also would i remove that sock.listen() is this what alowes only 1 client to connect
!!!!! think i found problem Private listener As System.Net.Sockets.TcpListener lol silly me
Last edited by anton2k; May 27th, 2008 at 11:06 AM.
You can not just copy parts of the code into your application, thats why you get that error. You havent declared 'Listener' (as is done in the original code), furthermore even if you declared it, doing it that way will not work good at all.
The execution will halt on this line:
VB.NET Code:
incomingClient = Listener.AcceptTcpClient
And return as soon as someone has connected. The code will continue executing but no more clients will be able to connect, because you're never calling Listener.AcceptTcpClient again.
This is why, in my example, Listener.AcceptTcpClient is done inside a loop.
And if you're going to use my listening code then you should replace it with your old listening code, and not use both.
Ok yea i see what u mean on client 1 loop but now its gicving me a new error no clue i tryed searching and change port some dude sugested
Private listener As System.Net.Sockets.TcpListener
Private Sub frmServer_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Do
Dim incomingClient As System.Net.Sockets.TcpClient
Sock.LocalPort = 1024
Sock.Listen()
ServerAcciones.Items.Add("Server is listening...")
Loop
End Sub
First off, what error are you getting?
I'll give you a list of points to fix:
You are now declaring 'listener' but you arent using it
You do not need to set the local port on each iteration.
You must not call Listen on each iteration, that would be prone for errors.
Another thing you must realize is that you're running an endless loop on the UI thread, this will freeze your application. In my example I'm running the loop on a separate thread, which you should too.
I dont understand, why do so many people want to make chat applications? I see so many threads on here about how to make a chat program when there are already loads out there...
I mean I know sometimes you need to make things yourself just for the learning experience but it just seems odd to me how everyone seems to go for the chat program..
Originally Posted by anton2k
Sure thay wont mind me using the grphic ater all its a site to help people athis soz i forgot to add atachment chek now
Hmmm just cos its a site to help people, doesnt mean you can blatantly use trademarked names in your own programs. What if you had made a well respected and popular website and then someone who you had never met in your life decided they were going to use your website name in their program and what if their program was really rubbish? I'm certainly not saying that your program will be rubbish but do you see what I mean?
Last edited by chris128; May 27th, 2008 at 01:59 PM.
I dont understand, why do so many people want to make chat applications? I see so many threads on here about how to make a chat program when there are already loads out there...
I mean I know sometimes you need to make things yourself just for the learning experience but it just seems odd to me how everyone seems to go for the chat program..
I would say that it is because networking is such an exciting area (it is, isnt it! ), and chat applications kinda is the first thing that comes to mind when thinking of distributed applications. Probably the easiest to create aswell.
I would say that it is because networking is such an exciting area (it is, isnt it! ), and chat applications kinda is the first thing that comes to mind when thinking of distributed applications. Probably the easiest to create aswell.
Yeah I guess a chat program is a fairly simple way to learn how to use the socket classes compared to most other types of applications.
I dont understand, why do so many people want to make chat applications? I see so many threads on here about how to make a chat program when there are already loads out there...
I mean I know sometimes you need to make things yourself just for the learning experience but it just seems odd to me how everyone seems to go for the chat program..
Hmmm just cos its a site to help people, doesnt mean you can blatantly use trademarked names in your own programs. What if you had made a well respected and popular website and then someone who you had never met in your life decided they were going to use your website name in their program and what if their program was really rubbish? I'm certainly not saying that your program will be rubbish but do you see what I mean?
yea i see i will probaly remove it then dont want to be the internets enmy lol any ways athiest my app is in my atchments
Last edited by anton2k; May 27th, 2008 at 02:25 PM.