Results 1 to 28 of 28

Thread: Big VBWire Project For The Coummunity

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2008
    Posts
    107

    Arrow Big VBWire Project For The Coummunity

    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

  2. #2
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    Re: Big VBWire Project For The Coummunity

    What do you mean exactly? This sentence confuses me:

    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
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Feb 2008
    Posts
    107

    Re: Big VBWire Project For The Coummunity

    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

    Sock.SendData(txtName.Text & ":" & txtSend.Text)
    Txtarrive.Text = String.Concat(Txtarrive.Text, vbNewLine & txtSend.Text)
    txtSend.Text = ""
    txtName.Text = txtName.Text

    End If
    End Sub

    only other users and the server can see the clints name before ther message in the recive boc i want the client to see his/her name also.

  4. #4
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    Re: Big VBWire Project For The Coummunity

    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:
    VB.NET Code:
    1. Txtarrive.AppendText(String.Format("{0}{1}:{2}", Environment.NewLine, txtName.Text, txtSend.Text))

    Furthermore, dont set txtSend.Text to "" to clear it, use the Clear method:
    VB.NET Code:
    1. txtSend.Clear()
    And this line can safely be removed
    VB.NET Code:
    1. txtName.Text = txtName.Text
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Feb 2008
    Posts
    107

    Re: Big VBWire Project For The Coummunity

    Thanks alot Atheist uch apreacated do u know how i can get the clients name to be read from a teaxt box on another forum though?

  6. #6
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    Re: Big VBWire Project For The Coummunity

    You'd need to have a reference to that form, in order to be able to access the TextBox in it. If you have a reference to the form, its as easy as:
    VB.NET Code:
    1. MyFormReference.MyTextBox.Text
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Feb 2008
    Posts
    107

    Re: Big VBWire Project For The Coummunity

    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

  8. #8
    Fanatic Member
    Join Date
    Apr 2006
    Posts
    746

    Re: Big VBWire Project For The Coummunity

    Could you add some code to filter out anyone using text-speak?
    ManagePC - the all-in-one PC management and inventory tool

  9. #9

    Thread Starter
    Lively Member
    Join Date
    Feb 2008
    Posts
    107

    Re: Big VBWire Project For The Coummunity

    Quote Originally Posted by Ginolard
    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!!

  10. #10
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    Re: Big VBWire Project For The Coummunity

    Check the TCP server/client example in my signature for a basic example of a chat solution.
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

  11. #11

    Thread Starter
    Lively Member
    Join Date
    Feb 2008
    Posts
    107

    Re: Big VBWire Project For The Coummunity

    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

  12. #12
    Member RockStarEnergy's Avatar
    Join Date
    Jan 2007
    Location
    Nebraska
    Posts
    54

    Re: Big VBWire Project For The Coummunity

    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.
    Attached Files Attached Files
    i <3

  13. #13

    Thread Starter
    Lively Member
    Join Date
    Feb 2008
    Posts
    107

    Re: Big VBWire Project For The Coummunity

    Thank you will try it out Realy apreacat evry one who has replyed to this thread to give me help it a gd forum i like it here

  14. #14

    Thread Starter
    Lively Member
    Join Date
    Feb 2008
    Posts
    107

    Re: Big VBWire Project For The Coummunity

    Yea tryed your source but its not what im lookign for but i might use the part from it were it displayes the user conected that cool

  15. #15
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    Re: Big VBWire Project For The Coummunity

    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:
    1. Private Sub doListen()
    2.         Dim incomingClient As System.Net.Sockets.TcpClient
    3.         Do
    4.             incomingClient = listener.AcceptTcpClient 'Accept the incoming connection. This is a blocking method so execution will halt here until someone tries to connect.
    5.             Dim connClient As New ConnectedClient(incomingClient, Me) 'Create a new instance of ConnectedClient (check its constructor to see whats happening now).
    6.             AddHandler connClient.dataReceived, AddressOf Me.messageReceived
    7.             clients.Add(connClient) 'Adds the connected client to the list of connected clients.
    8.  
    9.         Loop
    10.     End Sub
    See that it accepts a new connection request, creates a ConnectedClient class instance from it, and adds it to a collection of connected clients?
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

  16. #16

    Thread Starter
    Lively Member
    Join Date
    Feb 2008
    Posts
    107

    Re: Big VBWire Project For The Coummunity

    Yea i see lemmi try an implement this in to mine
    thanks once again

  17. #17

    Thread Starter
    Lively Member
    Join Date
    Feb 2008
    Posts
    107

    Re: Big VBWire Project For The Coummunity

    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.

  18. #18
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    Re: Big VBWire Project For The Coummunity

    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:
    1. 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.
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

  19. #19

    Thread Starter
    Lively Member
    Join Date
    Feb 2008
    Posts
    107

    Re: Big VBWire Project For The Coummunity

    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

    dose this look right?

  20. #20
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    Re: Big VBWire Project For The Coummunity

    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.
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

  21. #21

    Thread Starter
    Lively Member
    Join Date
    Feb 2008
    Posts
    107

    Re: Big VBWire Project For The Coummunity

    Sock.LocalPort = 1024
    thta line is green i atached the app below
    Attached Files Attached Files
    Last edited by anton2k; May 27th, 2008 at 01:49 PM.

  22. #22
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Big VBWire Project For The Coummunity

    You may want to come up with a different name as VBWire™ is trademarked.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  23. #23
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    Re: Big VBWire Project For The Coummunity

    Quote Originally Posted by anton2k
    Sock.LocalPort = 1024
    thta line is green i atached the app below
    The color of the line doesnt interest me The error message is whats important. I think you've forgotten to attach the application
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

  24. #24

    Thread Starter
    Lively Member
    Join Date
    Feb 2008
    Posts
    107

    Re: Big VBWire Project For The Coummunity

    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

  25. #25
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    Re: Big VBWire Project For The Coummunity

    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..

    Quote 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.
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


  26. #26
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    Re: Big VBWire Project For The Coummunity

    Quote Originally Posted by chris128
    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.
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

  27. #27
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    Re: Big VBWire Project For The Coummunity

    Quote Originally Posted by Atheist
    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.
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


  28. #28

    Thread Starter
    Lively Member
    Join Date
    Feb 2008
    Posts
    107

    Re: Big VBWire Project For The Coummunity

    Quote Originally Posted by chris128
    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
    Attached Files Attached Files
    Last edited by anton2k; May 27th, 2008 at 02:25 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width