You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by da...@apache.org on 2006/01/24 04:50:40 UTC
svn commit: r371793 - /webservices/axis2/trunk/c/test/core/clientapi/client.c
Author: damitha
Date: Mon Jan 23 19:50:36 2006
New Revision: 371793
URL: http://svn.apache.org/viewcvs?rev=371793&view=rev
Log: (empty)
Modified:
webservices/axis2/trunk/c/test/core/clientapi/client.c
Modified: webservices/axis2/trunk/c/test/core/clientapi/client.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/test/core/clientapi/client.c?rev=371793&r1=371792&r2=371793&view=diff
==============================================================================
--- webservices/axis2/trunk/c/test/core/clientapi/client.c (original)
+++ webservices/axis2/trunk/c/test/core/clientapi/client.c Mon Jan 23 19:50:36 2006
@@ -1,10 +1,12 @@
#include <stdio.h>
+#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <sys/types.h>
#include <sys/stat.h>
+#include <fcntl.h>
void error(char *msg)
{
@@ -17,10 +19,10 @@
int sockfd, portno, n, i;
struct sockaddr_in serv_addr;
struct hostent *server;
- int fd = open("soap_req", "r");
+ struct stat buf;
- char buffer[2000];
+ char *buffer;
if (argc < 3) {
fprintf(stderr,"usage %s hostname port\n", argv[0]);
exit(0);
@@ -44,16 +46,31 @@
if (connect(sockfd,&serv_addr,sizeof(serv_addr)) < 0)
error("ERROR connecting");
- while((i = read(fd, buffer, 1999)) > 0)
- /* printf("%s\n", buffer);*/
+ int tmp;
+ tmp = stat("soap_req", &buf);
+ printf("%d\n", buf.st_size);
+ buffer = malloc(buf.st_size* sizeof(char));
+ int fd = open("soap_req", O_RDONLY,0);
+ if (fd == -1)
+ {
+ printf("can't open file soap_req\n");
+ return;
+ }
+ else
+ printf("opened file soap_req\n");
+
+ while((i = read(fd, buffer, BUFSIZ)) > 0)
+ {
+ n = write(sockfd,buffer,strlen(buffer));
+ printf("%s", buffer);
+ if (n < 0)
+ error("ERROR writing to socket");
+ }
- n = write(sockfd,buffer,strlen(buffer));
- buffer[0] = '\0';
- if (n < 0)
- error("ERROR writing to socket");
- bzero(buffer,2000);
- n = read(sockfd,buffer,1999);
- printf("%s\n", buffer);
+/* bzero(buffer,2000);*/
+ buffer = '\0';
+ n = read(sockfd,buffer,BUFSIZ);
+ printf("%s\n", buffer);
if (n < 0)
error("ERROR reading from socket");
printf("%s\n",buffer);