ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hi I still writing my proxy server. I'm having trouble with the send commmand but I think its the way I'm trying to split the string thats causing the problems, because when I run the entire request string through it works.
Where client_buffer is a char[1024] got with recv from my client, it holds the requested web page. I am trying to split it so host holds the web address & request holds the requested file (after catination, ie GET /index.html HTML V1 \n\n).
But when I pass request to the host (after getting a connection) the program hangs. This does not happen when client_buffer is passed (which defeats the purpose of a proxy).
Basically I think I need a different or better way to spilt the string. Please help & also point out any really obvious mistakes I've made. (pls igone the random variable defined for debug purposes that haven't been talken out).
a format string should absolutly contain conversions character
%s string
%d integer
etc...
you only specify %
that's why it fucks up
and you close " as well few times in your html code... you cant do it as is...
and hummm... If I were you I would rather consider using strtok() function to parse your string in tokens instead...
do not malloc a buffer to 1024 directly hardcoded
use fstat() to read the higher block size for better I/O efficiency
declare a struct stat using st_blksize member
I recommand using read() and write() instead of recv(), send() respectivly.
I had experience writing a TCPIP tunnel software and it decreases overhead time..
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.