# socket programmin

**URL:** <https://community.unix.com/t/socket-programmin/158988>\
**Category:** IP Networking\
**Created:** [January 23, 2006, 11:42am UTC](https://community.unix.com/t/socket-programmin/158988 "2006-01-23T11:42:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![yogesh\_powar](https://community.unix.com/user_avatar/community.unix.com/yogesh_powar/32/205_2.png) [@yogesh\_powar](https://community.unix.com/u/yogesh_powar)\
**Post date:** [January 23, 2006, 11:42am UTC](https://community.unix.com/t/socket-programmin/158988/1 "2006-01-23T11:42:08Z")

</div>

I was trying to write proxy code but i here is a problem

typedef struct req\_msg  
{  
char \*host;//hostname  
char \*filename;//filename  
char \*modified;//date  
char \*data;  
char \*request;  
}req\_msg;

```
while\(take_responce\(req,request\)!=0\)

```

// take\_responce gets responce from http server  
// req is req\_msg  
//data from the server is received in req-\>data  
{  
totaldata=strlen(req-\>data);  
if(send(sock,req-\>data,totaldata,0))  
//this is proxy's client socket  
//data received from the http server is forwarded to client  
{  
Die("Server failed to send the data");  
}  
//buffer is made clean every time afte its use  
free(req-\>data);  
}

after running the code is failed after saying this  
Server failed to send the data: Success

SoS :mad:
