Archived Forum Post

Index of archived forum posts

Question:

Socket Usage

Apr 11 '17 at 11:14

I tried posting this question a few days ago but it hasn't appeared, I think because I hadn't confirmed my email.
I have to change an old vb6 program to use https rather than http for uploading files to a server. I know very little about this process or about Chilkat socket so please excuse if these are obvious questions. The program currently uses a Winsock.
Two questions: 1. The program sends a series of http headers then a text file (typically about 200 lines) then the server responds with a short acknowledge message. Does anything about this change with a Chilkat socket or because of https? Basically, do I just Connect, sendline, sendline, etc then I get back a response? 2. Sometimes (infrequently but randomly) the server will send back a file as part of its' acknowledgment so its' usual 100 byte response will change to about a 15k reply. Note that this response is normally split by the tcp/ip on the server into an arbitrary number of blocks so the Winsock version has to wait for perhaps dozens of individual blocks to arrive. How do I receive these with a Chilkat socket?

Thanks for your help Ian


Answer

Hi Ian,

If you're intending to go down the path of communicating with an HTTP server via the Socket API (as opposed to the HTTP or REST API), then what you're really doing is attempting to implement the HTTP protocol. There's no simple answer for your question. My recommendation would be to buy this book: HTTP: The Definitive Guide, study it, and then allocate a number of months to implement the protocol, and even then it wouldn't be a solid implementation because I can tell you from experience that HTTP is far more involved than it would appear.

(Or you could just use a library that already implements the HTTP protocol, such as Chilkat's HTTP or REST API.)


Answer

Thank you for that reply. I will surely look at your http product.