I experimented with callbacks and waiting on signals, but couldn't sort my logic out. I could make it work when I was receiving a stream of data back, but I need to receive, wait for a prompt, send and wait for a prompt, send again then wait for a prompt. I couldn't make out how to do this and separate the wait/check for prompt functionality from the receiving data functionality which could end up messy.
I thought I was being very clever by using the "txtResponse.textChanged" event to check for the prompt, but forgot that the server echoes back what's sent to it. Though having said that, I would only need to change my checking, as I was using inStr(response, "Username:" ) but could use response.endsWith or similar.
Hmmmm.
Anyhow, I'm now back to using the winsock send/receive functionality through the Winsock Revamped component found here (http://www.codeproject.com/KB/IP/winsock_revamped.aspx). It's working, but I don't like the way I've made it work. It's untidy and probably "dangerous".
What I really need to find is some examples of some similar application, but the only examples that I can find are really simple ones that send data and receive it, but don't necessarily have a "flow" to them, where there may be login prompts involved.
I thought I was being very clever by using the "txtResponse.textChanged" event to check for the prompt, but forgot that the server echoes back what's sent to it. Though having said that, I would only need to change my checking, as I was using inStr(response, "Username:" ) but could use response.endsWith or similar.
Hmmmm.
Anyhow, I'm now back to using the winsock send/receive functionality through the Winsock Revamped component found here (http://www.codeproject.com/KB/IP/winsock_revamped.aspx). It's working, but I don't like the way I've made it work. It's untidy and probably "dangerous".
What I really need to find is some examples of some similar application, but the only examples that I can find are really simple ones that send data and receive it, but don't necessarily have a "flow" to them, where there may be login prompts involved.
There are no comments on this entry. (Reply.)