Peter Rothenbuecher wrote:
> Hello,
> when I try to compile the following code with g++ -o client client.c
>
>
> #include<sys/socket.h>
This is a non-standard header and is thus off-topic here. You should
post in a newsgroup for your platform. See the FAQ for what is on-topic
here and for some suggestions for better newsgroups to post in:
http://www.parashift.com/c++-faq-lit...t.html#faq-5.9
> #include<stdio.h>
> #include<stdlib.h>
If you're doing C++ rather than C (which we assume since you're posting
here but which the coding style doesn't reflect), prefer:
#include <cstdio>
#include <cstdlib>
Better, prefer <iostream> and other C++ standard library headers.
>
> #define ADDRESS "mysocket";
> #define MAXLEN 200;
You probably don't want semicolons after these lines.
>
> int main(int argc, char *argv)
You don't use argc and argv. Drop them.
> {
> int sd;
> struct sockaddr_un sa;
> int length;
> char netmsg[MAXLEN];
[snip]
First, in C++, you should not declare variables until you can
initialize and use them. IOW, don't put all the declarations at the
top.
Second, it looks like sockaddr_un is undefined. Look in your
non-standard header <sys/socket.h> for the function prototype for
bind(), and you'll see what it should be called (probably just
sockaddr).
Cheers! --M