Results 1 to 19 of 19

Thread: data arrival help select case

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Sep 2022
    Posts
    28

    data arrival help select case

    removed waste of time
    Last edited by David_chan; Sep 27th, 2022 at 08:08 PM.

  2. #2
    PowerPoster
    Join Date
    Nov 2017
    Posts
    2,169

    Re: data arrival help select case

    Stop creating new accounts jenniger/tuffan/David_chan

  3. #3
    Frenzied Member
    Join Date
    Feb 2003
    Posts
    1,649

    Re: data arrival help select case

    I could provide a Winsock sample if you like.

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Sep 2022
    Posts
    28

    Re: data arrival help select case

    Quote Originally Posted by Peter Swinkels View Post
    I could provide a Winsock sample if you like.
    please send your sample it will help alot

  5. #5
    Frenzied Member
    Join Date
    Feb 2003
    Posts
    1,649

    Re: data arrival help select case

    Attached is a program that can act either as a client or as a server. Start two instances, set one to act as a client and the other as a server. You will need to specify a port and ip address for the server to listen to and then set it to listen. You can then connect the client using this ip and port address. If you need more help, just let me know. Okay?

    EDIT:
    I see this is one my of my older projects. I might as well update the code and write a manual for it.
    Attached Files Attached Files

  6. #6
    Frenzied Member
    Join Date
    Feb 2003
    Posts
    1,649

    Re: data arrival help select case

    For anyone interested, an updated version of the program I posted earlier in this thread. With a manual this time.
    Attached Files Attached Files
    Last edited by Peter Swinkels; Sep 26th, 2022 at 12:47 PM.

  7. #7
    PowerPoster
    Join Date
    Feb 2006
    Posts
    23,812

    Re: data arrival help select case

    Here is another example of a "both server and client in one" that actually addresses the issues of stream assembly and message parsing.

    Compile, then run two copies. The first one becomes the server.
    Attached Files Attached Files

  8. #8
    PowerPoster
    Join Date
    Feb 2006
    Posts
    23,812

    Re: data arrival help select case

    Part of the issue with sending messages over a stream (like a TCP connection, or even serial COMx: ports) is that your application must provide framing.

    For a simple text protocol this is normally some delimiter sequence that cannot occur within the data. For binary protocols and payloads you usually have to provide framing via some length field in a message header. Delimiters don't work because "anything goes" in binary data.

    Don't fall for the packet fallacy. TCP does not send data in "packets" and TCP efficiency features like Nagling often coalesce several "writes" into one transmitted data segment. Arrival must be considered totally random, and every "read" might return 1 to many bytes of data. A given segment you read in might well span two or more application messages.


    All of that is pretty old news of course, though newcomers still struggle to grasp this and let go of misconceptions.

  9. #9
    Frenzied Member
    Join Date
    Feb 2003
    Posts
    1,649

    Re: data arrival help select case

    @dilettante:
    Couldn't delimiters in binary data be made to work by using escape sequences? (Define one character as the delimiter, another as an escape character) Anyway, what methods are commonly used to solve this problem?

  10. #10
    PowerPoster
    Join Date
    Feb 2006
    Posts
    23,812

    Re: data arrival help select case

    Sure, some sort of escaping could be done. But in the end it is easier to just use a prefixed byte count most of the time for binary data.

  11. #11
    PowerPoster wqweto's Avatar
    Join Date
    May 2011
    Location
    Sofia, Bulgaria
    Posts
    4,326

    Re: data arrival help select case

    What do you think this code

    Select Case "╚startcode╚"
    Case "||error||"'
    . . .
    End Select


    . . . actually does?

    Nothing. It does absolutely nothing!

    Stop wasting everybody's time here and read a book on basic programming. Search for introduction to VB6 books, incl. introduction to computers, anything about programming would be of great use to you.

    cheers,
    </wqw>

  12. #12

    Thread Starter
    Junior Member
    Join Date
    Sep 2022
    Posts
    28

    Re: data arrival help select case

    Quote Originally Posted by wqweto View Post
    What do you think this code

    Select Case "╚startcode╚"
    Case "||error||"'
    . . .
    End Select


    . . . actually does?

    Nothing. It does absolutely nothing!

    Stop wasting everybody's time here and read a book on basic programming. Search for introduction to VB6 books, incl. introduction to computers, anything about programming would be of great use to you.

    cheers,
    </wqw>
    wqweto the whole reason for the forum is to reach out to people for help.
    now, you're referring me to go read the vb6 book. with the stuff am trying to do with limited time because I work for a living also. time doesn't permit me to read 1-100 pages of the book. a simple correction or tips/guidance will benefit anybody including you for helping others don't you think?
    you may see yourself as a vb6 experience user, right? but please do not forget I also know other languages and expert at them also.
    people cant be good at everything but know little about it. and do try and make a small program to help ease the repeated task.

    think of one thing. just imagine one day you needed help and a guy replied the way you did on your post. please tell me how you will feel. please tell me.

  13. #13

    Thread Starter
    Junior Member
    Join Date
    Sep 2022
    Posts
    28

    Re: data arrival help select case

    removed waste of time
    Last edited by David_chan; Sep 27th, 2022 at 08:08 PM.

  14. #14
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    5,435

    Re: data arrival help select case

    The ôselect caseö should be followed by a variable, not some exact text.
    And the least you can do is read the help for Select Case

  15. #15

    Thread Starter
    Junior Member
    Join Date
    Sep 2022
    Posts
    28

    Re: data arrival help select case

    removed waste of time
    Last edited by David_chan; Sep 27th, 2022 at 08:07 PM.

  16. #16
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    5,435

    Re: data arrival help select case

    Sorry, but I donĺt understand what you want to achieve

  17. #17
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,000

    Re: data arrival help select case

    Quote Originally Posted by David_chan View Post
    i think like this.
    Code:
    Dim grade As String
    Private Sub Compute_Click( )
    grade=txtgrade.Text
    Select Case grade
    Case "A"
    result.Caption="High Distinction"
    Case "A-"
    result.Caption="Distinction"
    Case "B"
    result.Caption="Credit"
    Case "C"
    result.Caption="Pass"
    Case Else
    result.Caption="Fail"
    End Select
    End Sub
    so in dataarrivate i can just add my string here
    grade= mystring here a,b,c

    but i want to know is this string gets sent from client Winsock1.SendData "╚startcode╚" & "||3333||" & "demo text"

    in server
    winsock1.getdata data gets string below
    Code:
    "╚startcode╚" & "||3333||" & "demo text"
    how do i chop it up and use this "╚startcode╚" as the main string and the rest after that use it as case "||3333||" which should return demo text
    Look up split


    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  18. #18

    Thread Starter
    Junior Member
    Join Date
    Sep 2022
    Posts
    28

    Re: data arrival help select case

    its ok its my last post.
    i know people intentionally dont want to help i get it.
    no problem.

    just remmeber to all the haters. whatever goes around comes around.
    vb6 is old. we took the time to travel back and come to these forums for help but people like you show be so offensive, defensive, in denial and arrogance will face karma.

    you think you know vb6,vb.net you are on top of others think again man. we just come here like others for help. some day you will go around the same way asking for help. some day i hope u get denied too. you need to feel it. the day you do will understand it. don't worry that day will come for you.
    just get laid and get rid of your stress.
    haters haters haters.

  19. #19
    PowerPoster wqweto's Avatar
    Join Date
    May 2011
    Location
    Sofia, Bulgaria
    Posts
    4,326

    Re: data arrival help select case

    @David_chan: The best way to avoid whatever toxicity you get from old members here is to *not* create new accounts once you get added to peoples ignore lists.

    This or read a book on VB6 -- the easiest programming language. This is not rocket science, it's not like C/C++

    cheers,
    </wqw>

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