socket programmin


 
Thread Tools Search this Thread
Special Forums IP Networking socket programmin
# 1  
Old 01-23-2006
PHP socket programmin

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 Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Programming

gdbm with c programmin Books & Tutorial.

Hello, Could you please tell me if there are any books/tutorial on gdbm programming with C for beginners. So far, I've found few tutorials and one of those: http://www.network-theory.co.uk/docs/gccintro/gccintro_22.html is easy to understand but very short in treatment as it dealt with ... (6 Replies)
Discussion started by: vectrum
6 Replies

2. IP Networking

Clarification - Setting socket options at the same time when socket is listening

I need clarification on whether it is okay to set socket options on a listening socket simultaneously when it is being used in an accept() call? Following is the scenario:- -- Task 1 - is executing in a loop - polling a listen socket, lets call it 'fd', (whose file descriptor is global)... (2 Replies)
Discussion started by: jake24
2 Replies

3. Programming

Error with socket operation on non-socket

Dear Experts, i am compiling my code in suse 4.1 which is compiling fine, but at runtime it is showing me for socket programming error no 88 as i searched in errno.h it is telling me socket operation on non socket, what is the meaning of this , how to deal with this error , please... (1 Reply)
Discussion started by: vin_pll
1 Replies

4. Programming

socket function to read a webpage (socket.h)

Why does this socket function only read the first 1440 chars of the stream. Why not the whole stream ? I checked it with gdm and valgrind and everything seems correct... #include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <sys/stat.h> #include <string.h> #include... (3 Replies)
Discussion started by: cyler
3 Replies

5. Programming

which socket should socket option on be set

Hi all, On the server side, one socket is used for listening, the others are used for communicating with the client. My question is: if i want to set option for socket, which socket should be set on? If either can be set, what's the different? Again, what's the different if set option... (1 Reply)
Discussion started by: blademan100
1 Replies

6. UNIX for Advanced & Expert Users

connect problem for sctp socket (ipv6 socket) - Runtime fail Invalid Arguments

Hi, I was porting ipv4 application to ipv6; i was done with TCP transports. Now i am facing problem with SCTp transport at runtime. To test SCTP transport I am using following server and client socket programs. Server program runs fine, but client program fails giving Invalid Arguments for... (0 Replies)
Discussion started by: chandrutiptur
0 Replies

7. IP Networking

IP Socket

Please need to setup a IP Socket on SCO Open Server 5.06 / 5.07 to a Linux machine. Al that I want to do is via a simple shell command open a tcpip address, port number, and send a call to a progam with a name of a file on the linux box. My programming language does not support socket... (1 Reply)
Discussion started by: comcaps
1 Replies

8. Shell Programming and Scripting

file editting with shell programmin

Hello, I have several handreds of text files. The format of file looks like: column1 column2 column3 column4 column5 id1 definition1 name1 fieldid comm1 id2 definition2 name2 fieldid ... (4 Replies)
Discussion started by: ssshen
4 Replies

9. Programming

Socket Programming socket

Hello, I actually try to make client-server program. I'm using SCO OpenServer Release 5.0.0 and when I try to compile my code (by TELNET) I've got this error : I'm just using this simple code : and I get the same error if I use : If someone can help me, Thanks (2 Replies)
Discussion started by: soshell
2 Replies

10. Shell Programming and Scripting

Books on Shell programmin

Can Anyone suggest few good books on Unix Shell Programming and C on Unix. Thanks Prasad (5 Replies)
Discussion started by: pswar70
5 Replies
Login or Register to Ask a Question
ethers(3n)																ethers(3n)

Name
       ethers, ether_ntoa, ether_aton, ether_ntohost, ether_hostton, ether_line - Ethernet address mapping operations

Syntax
       #include <sys/types.h>
       #include <sys/socket.h>
       #include <net/if.h>
       #include <netinet/in.h>
       #include <netinet/if_ether.h>

       char *
       ether_ntoa(e)
	    struct ether_addr *e;

       struct ether_addr *
       ether_aton(s)
	    char *s;

       ether_ntohost(hostname, e)
	    char *hostname;
	    struct ether_addr *e;

       ether_hostton(hostname, e)
	    char *hostname;
	    struct ether_addr *e;

       ether_line(l, e, hostname)
	    char *l;
	    struct ether_addr *e;
	    char *hostname;

Arguments
       The structure is defined as:
       struct ether_addr {
	       u_char  ether_addr_octet[6];
       };

Description
       These  routines	are  useful for mapping 48 bit Ethernet numbers to their ASCII representations or their corresponding host names, and vice
       versa.  The mapping is obtained from the database; see

       The function converts a 48 bit Ethernet number pointed to by e to its standard ACSII representation; it returns	a  pointer  to	the  ASCII
       string.	 The  representation is of the form: x:x:x:x:x:x where x is a hexadecimal number between 0 and ff.  The function converts an ASCII
       string in the standard representation back to a 48 bit Ethernet number;	the function returns NULL if the string cannot be scanned success-
       fully.

       The  function  maps  an Ethernet number (pointed to by e) to its associated hostname.  The string pointed to by must be long enough to hold
       the hostname and a NULL character.  The function returns zero upon success and non-zero upon failure.  Inversely, the function maps a host-
       name  string  to  its  corresponding Ethernet number; the function modifies the Ethernet number pointed to by e.  The function also returns
       zero upon success and non-zero upon failure.

       The function scans a line (pointed to by l) and sets the hostname and the Ethernet number (pointed to by e).  The string pointed to by must
       be long enough to hold the hostname and a NULL character.  The function returns zero upon success and non-zero upon failure.  The format of
       the scanned line is described by

Files
       See Also
	      packetfilter(4), ethers(5), rarpd(8c)

																	ethers(3n)