Results 1 to 8 of 8

Thread: Whats the best way to send varables between processes rapidly?

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jul 2003
    Posts
    1,269

    Whats the best way to send varables between processes rapidly?

    Whats the best way to send and receive data between two processes? I have about 10 processes open, all needing to work with data from the (1) main process. My current method is that the main process has all the data in a listbox, and each of the 10 processes grab the first item from that listbox, then delete the first item, so that 10 processes can work at their own pace with data that is stored in the main process.

    but naturally , this can create problems. ive found if many apps access that listbox at the same time, and delete items at the same time, the app can crash.

    which leads me to this post. what would be the best way of sending/receiving data between applciations?

    i thought of another way.. to have an array of 10 textboxes, with the main process assigning the text to those textboxes. the other processes could use WM_GETTEXT to retrieve the string stored in that textbox, and process the data. when finished it could use WM_SETTEXT to set the textbox string to "done", then in the textbox_change event, ill be able to tell which process has completed its task on that string, and the app can assign a new string to the box which the process can retrieve again.

    is there a better method to do this?

  2. #2
    The picture isn't missing BuggyProgrammer's Avatar
    Join Date
    Oct 2000
    Location
    Vancouver, Canada
    Posts
    5,217
    Some programs use Winsock with the loopback ip(localhost, which basically is 127.0.0.1).
    Remember, if someone's post was not helpful, you can always rate their post negatively .

  3. #3
    Frenzied Member vbNeo's Avatar
    Join Date
    May 2002
    Location
    Jutland, Denmark
    Posts
    1,994
    Winsock is a very good solution, which I'll strongly recommend, it's an easy, safe and fast way to communicate...
    "Lies, sanctions, and cruise missiles have never created a free and just society. Only everyday people can do that."
    - Zack de la Rocha


    Hear me roar.

  4. #4
    yay gay PT Exorcist's Avatar
    Join Date
    Apr 2002
    Location
    . . . my reason of shame
    Posts
    2,729
    omg? Winsock? Why don't you just send info through SendMessage? It's obviously the BEST way
    \m/\m/

  5. #5
    Frenzied Member vbNeo's Avatar
    Join Date
    May 2002
    Location
    Jutland, Denmark
    Posts
    1,994
    Originally posted by PT Exorcist
    omg? Winsock? Why don't you just send info through SendMessage? It's obviously the BEST way
    Because WinSock does allow dynamic interfacing by all applications using the windows sockets, without needed usage for cryptic api code...
    "Lies, sanctions, and cruise missiles have never created a free and just society. Only everyday people can do that."
    - Zack de la Rocha


    Hear me roar.

  6. #6
    The picture isn't missing BuggyProgrammer's Avatar
    Join Date
    Oct 2000
    Location
    Vancouver, Canada
    Posts
    5,217
    Well if you are willing to subclass, you can use SendMessage with a UDT.

    But with winsock, you would just need to know the port to connect to, wheras you would need to use specific FindWindow calls to get the main window.
    Remember, if someone's post was not helpful, you can always rate their post negatively .

  7. #7
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632
    My multithreading code can handle this.
    Click on the link in my sig. And then run the 1st simple demo. This shows how data can be passed between 2 EXEs synchronously and asynchronously.

    I feel winsock is overkill here and would be messy to implement.

    Woof

  8. #8

    Thread Starter
    Frenzied Member
    Join Date
    Jul 2003
    Posts
    1,269
    i didnt try your code widget as you replied after i had already implemented the winsock..

    but wow - is it ever easy to do it with winsock.

    lets say you want to process data in a listbox, say 10,000 items. a single thread cant do this quickly. so if you open like 100 'clones' of you program (no gui, only code for processing is here) you can simulate 'multithreading' very very well.. just specify variables like.. say 'timeout', and specify them to
    your 'threads' by using
    for x = 1 to threadcount
    Shell appaddon.exe -timeout 100 -id x.
    next

    the id will be unique for each thread, and the programs can use the id to decide what port to connect on .

    threads that are done processing data can send a message to the main form, which would deliver it another string from the listbox to work with.

    wonderful idea with the winsock

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