I am trying to write a small program that sends some data over the
network to a server. The data I want to send is read from the command
line i.e. dms 2 somedata otherdata value hostname port. I have the
client talking to the server. The problem I am having sending the
command data to the server. CreateDSM creates the network connection
to the server. This is what I am doing:
int A, B,dsm1, dsm2;
struct fullpacket {
int requesttype;
char varname;
int vartype;
char varval;
} packet;
main(int argc, char *argv[])
{
dsm1=CreateDSM(argv[5], argv[6]);
newVar(dsm1, argv[2], argv[3], argv[4]);
exit(0);
}
int newVar(const char *varname, const char *vartype, const char
*initialvalue)
{ packet.requesttype=1;
packet.varname=*varname;
packet.vartype=*vartype;
packet.varval=*initialvalue;
(void) write(dsm1, packet, sizeof(packet));
}
As you can see I am trying to write a struct to a socket. When I
compile I get the following message: incompatible type for argument 2
of 'write'. How can I fix it or get around this problem?
Thanks,
Mike