Page 2 of 2 FirstFirst 12
Results 41 to 50 of 50

Thread: IOCP Server - VB6

  1. #41
    PowerPoster
    Join Date
    Jan 2020
    Posts
    5,538

    Re: IOCP Server - VB6

    Quote Originally Posted by couttsj View Post
    Have you tried the supplied GetFile program? It uses SimpleSck, which is older and slower, but it should still work.

    I am close to having the remote picture viewer ready for posting. It crashes when downloading an 11 MB file, but works fine with a 1.6 MB file.

    J.A. Coutts
    you need upload a full project for test.use project group
    one is server,one is client,only for click send file

    but your project i try about 3 hours,can't run it together

    As long as the design is good, 100MB or 1000MB can be sent completely

  2. #42

    Thread Starter
    Frenzied Member
    Join Date
    Dec 2012
    Posts
    1,668

    Re: IOCP Server - VB6

    Quote Originally Posted by xiaoyao View Post
    you need upload a full project for test.use project group
    one is server,one is client,only for click send file

    but your project i try about 3 hours,can't run it together

    As long as the design is good, 100MB or 1000MB can be sent completely
    I presume you have defined the SharePath in the server. The default is C:\share\ and it is located in ModMT.

    J.A. Coutts

  3. #43
    PowerPoster
    Join Date
    Jan 2020
    Posts
    5,538

    Re: IOCP Server - VB6

    Quote Originally Posted by couttsj View Post
    I presume you have defined the SharePath in the server. The default is C:\share\ and it is located in ModMT.

    J.A. Coutts
    You need to design a code that works out of the box
    For example, the client can click to send and the server can receive.

    Maybe I'm wrong. This is a function similar to FTP download.
    There are many files on the server and clients. Send the command and then get the data from it.

    The main reason is that your example is not complete.

  4. #44

    Thread Starter
    Frenzied Member
    Join Date
    Dec 2012
    Posts
    1,668

    Re: IOCP Server - VB6

    The IOCP_Svr program has been substantially modified. The main change has been to move the work function from a class to a module and to put the Listen function on its own thread. This has allowed for all the delays to be removed. Printing functions used by VB6 (eg. Debug.Print) sometimes interferes with API functions used. Therefore, debugging information can be displayed in a text box using DbgPrint. This function uses TryEnterCriticalSection to isolate it from conflicting threads.

    I used "C:\share" to list files to share on the server, and on the receiving end I used "C:\Download" to store the files downloaded. Headers are used on all records, with the initial client connection sending "Hello". The server responds with a list of the shared file names and size separated by a space. The Client saves the file names to a list box. When the client selects a file to download, it opens a file with the file length provided. If that file already exists, it asks the client if it is to be overwritten. It then sends the file name to the server and the server responds.

    There is an outstanding problem that I have not been able to resolve, and any assistance would be appreciated. When I attempt to exit the program after several large file downloads, the IDE itself shuts down.
    ----------------------------------------------------
    1,646,411 EndCliff.JPG - Using single connection
    EndCliff.JPG Saved in 375ms
    EndCliff.JPG Saved in 265ms
    EndCliff.JPG Saved in 296ms
    EndCliff.JPG Saved in 344ms
    (IDE remained when program exited)
    1,646,411 EndCliff.JPG - Using multiple connections
    EndCliff.JPG Saved in 375ms
    EndCliff.JPG Saved in 407ms
    EndCliff.JPG Saved in 375ms
    EndCliff.JPG Saved in 360ms
    (IDE remained when program exited)

    11,533,852 sample.jpg - Using single connection
    sample.jpg Saved in 2750ms
    sample.jpg Saved in 2453ms
    sample.jpg Saved in 2687ms
    sample.jpg Saved in 2313ms
    (IDE shut down when program exited)
    11,533,852 sample.jpg - Using multiple connections
    sample.jpg Saved in 4984ms
    sample.jpg Saved in 4938ms
    sample.jpg Saved in 5297ms
    sample.jpg Saved in 5250ms
    (IDE shut down when program exited)
    ---------------------------------------------------
    It looks like something is not being properly cleaned up after sending larger files, but I have no idea what that is.

    J.A. Coutts
    Note: All testing so far has been between the client on a WiFi network and a server on a wired network.

  5. #45

    Thread Starter
    Frenzied Member
    Join Date
    Dec 2012
    Posts
    1,668

    Re: IOCP Server - VB6

    As I developed IOCP_Svr in the IDE, I neglected to test the executable. When I finally did, the executable would display the form and then disappear. The program was based on an Echo Server called "#Prj_VB_iocp_Server_En1.vbp". An Echo Server did not come close to meeting my requirements, but it was a good starting point. So I went back to the original and started all over, this time testing the executable as I went along.

    It turned out that there were several issues, that all seemed to be related to string manipulation within the worker routine. I have no idea why.
    1. Each received record was copied, cleared, and the header recovered and removed. That was changed to shifting the buffer left 5 places after recovering the header.
    2. The executable did not like the file list creation routine, so it was moved outside of the worker routine and stream lined.
    3. The file name was originally saved in a string array. That was changed to a simple string.
    4. To access files, the API required pointers only. The code originally used "lstrcpyW" and "lstrlenW" to create the file name from the pointer. This was changed by transferring the string name as well and using "StrPtr" to open the file.

    There was one small change required to the Client program, so that download has also been updated.

    I am not going to suggest that this is the last of my problems with this program, but it appears to have addressed the crashing of the executable.

    J.A. Coutts

  6. #46
    New Member woeoio's Avatar
    Join Date
    Jan 2022
    Posts
    12

    Re: IOCP Server - VB6

    I think if you are just looking for a high-performance socket server, this library might be of help to you.

    cWinsock Class Development Documentation | VB6 PRO DOCS
    https://doc.vb6.pro/en/vbman/winsock/overview.html

  7. #47
    New Member woeoio's Avatar
    Join Date
    Jan 2022
    Posts
    12

    Re: IOCP Server - VB6

    vbman 's cWisncok is based on VbAsyncSocket: [email protected], but encapsulates a simpler and more user-friendly object that you can keep Winsock.ocx as it is, but it is better. Similarly, vbman is free and will be open-sourced after the migration to Twinbasic

  8. #48

    Thread Starter
    Frenzied Member
    Join Date
    Dec 2012
    Posts
    1,668

    Re: IOCP Server - VB6

    Quote Originally Posted by woeoio View Post
    I think if you are just looking for a high-performance socket server, this library might be of help to you.

    cWinsock Class Development Documentation | VB6 PRO DOCS
    https://doc.vb6.pro/en/vbman/winsock/overview.html
    Thank you for the feedback. Microsoft is clear that the highest throughput is achieved using Overlapped I/O in non-blocking or asynchronous mode using multiple threads. I only supplied the Client program because it was needed in order to interface with the server, and SimpleSock for me was stable and manageable. Any Client program could have been used, and Vbman may indeed be better suited, but this post is essentially about the high speed server.

    J.A. Coutts

  9. #49
    New Member woeoio's Avatar
    Join Date
    Jan 2022
    Posts
    12

    Talking Re: IOCP Server - VB6

    Quote Originally Posted by couttsj View Post
    Thank you for the feedback. Microsoft is clear that the highest throughput is achieved using Overlapped I/O in non-blocking or asynchronous mode using multiple threads. I only supplied the Client program because it was needed in order to interface with the server, and SimpleSock for me was stable and manageable. Any Client program could have been used, and Vbman may indeed be better suited, but this post is essentially about the high speed server.

    J.A. Coutts
    Yes, I'm sorry, it's my fault that I didn't see the previous context

  10. #50

    Thread Starter
    Frenzied Member
    Join Date
    Dec 2012
    Posts
    1,668

    Re: IOCP Server - VB6

    Please note that if you are going to transfer fairly large files using the executable, you will need to adjust the buffer size (MAX_PERBUFLEN). The current posting of IOCP_Svr uses a buffer size of 1,024 and crashes when transferring an 11MB file, but not when using a 8,192 byte buffer.

    J.A. Coutts

Page 2 of 2 FirstFirst 12

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