Closed Shriya1181 closed 3 months ago
Maybe you need to set the folder from which the server reads the files?
The path to the file we are sending seems to be correct. When trying the same in a Linux system, we are able to successfully send the files.
What is your working directory, and what is the command that you used to start the server? same for client?
The working directory is "picoquic\x64\Release", picoquic is the cloned repo and x64/Release was created after building the .sln file in Visual Studio. The command used for server is - ./picoquic_sample.exe server 4433 ./ca-cert.pem ./server-key.pem ./server_files and the command for the client is - ./picoquic_sample client localhost 4433 ./server_files index.htm.
You should not use the same directory on the server and client side -- on the client, this should be "client_files", otherwise the incoming file will erase the file that the server sends.
The other issue is the notation "./server_files". "./" is a Unix convention. On windows, that should be ".\". Or just "server_files".
I don't think that is the issue; from my understanding, we write server files on the client side as we are requesting that file from the server
The above is the code for both the client and server as well as the output for the same.
Found it.
I tried on my own PC, and if I launch the program as:
Debug> dir .\server_files\
Directory: C:\Users\huite\GitHub\picoquic\x64\Debug\server_files
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 12/1/2021 12:17 PM 10000 10K.txt
-a---- 1/18/2022 8:50 PM 386 index.html
Debug> .\picoquic_sample.exe server 4434 ..\..\certs\cert.pem ..\..\certs\key.pem .\server_files
Starting Picoquic Sample server on port 4434
I get:
Debug> .\picoquic_sample.exe client localhost 4434 .\client_files\ index.html
Starting connection to localhost, port 4434
Initial connection ID: 913f6bdc8be45642
Opened stream 0 for file index.html
Waiting for packets.
Connection to the server completed, almost ready.
Connection to the server confirmed.
Connection closed.
index.html: complete, received 386 bytes
Debug> dir .\client_files\
Directory: C:\Users\huite\GitHub\picoquic\x64\Debug\client_files
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 3/22/2024 8:30 PM 386 index.html
The error index.html: reset, received 0 bytes, error 0x103 -- no such file
is happening if the server cannot open the required file. More precisely, the server is going to concatenate:
So, in our case, we will get file_name = .\server_files\index.html
. The error happen if fopen(file_name, "rb")
fails -- either because there is no such folder or the file does not exist.
Okay, from what I understand, in the client server code, we must specify where we want to send the file to (here we give the name client_files) and request a file from the server present in the directory specified in the server (in this case server_files). The server sends the file and a copy of the file is made in client_files. Thanks a lot for the help. Also is there any difference between using the pem files inside x64/Release vs. the ones in the cert folder. I noticed that in your PC you used Debug config of the solution instead of Release, is that perfered?
The pem files in the cert folder are test files. The server will send a copy of the certificate (or certificate chain) in the initial exchange, and use the key to sign it. The client will apply PKI logic to verify the certificate chain against a list of root certificates. In production, you should use "real" keys and certificates.
There is no difference in behavior between "release" and "config" -- the release version is faster because it uses more compile optimization, the debug version allows step by step debugging. I had the debug version ready because I was debugging another issue.
Thanks for the information and for resolving the issue.
After building the picoquic repo on a Windows system, we wanted to test quic by using the sample server and client files present in "\picoquic\x64\Release\picoquic_sample.exe". We were able to get both server and client up and running smoothly, however when the client requests for "\picoquic\x64\Release\server_files\index.htm" from the server, the connection terminates with the error: "Could not open the file: server_files\index.htm" and "index.htm: unknown status, received 0 bytes" being shown after the connection has closed. How do we resolve this error.