Вобщем написал сокет сервер - все работает только выдает 2 warning: при компиляции , я не могу их устранить
вот полный код сервера
Код:
#include <iostream.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <time.h>
#include <arpa/inet.h>
#define PORT 5190
#define SERVER_IP "000.000.00.000"
void NewClient (int client){
while(1){
char buffer[1024];
bzero(buffer,sizeof(buffer));
if(recv(client, buffer, sizeof(buffer),0) != 0){
cout << buffer "\n";
}
}
}
int main ( )
{
int sockfd,client;
sockfd = socket(PF_INET, SOCK_STREAM, 0);
socklen_t size;
struct sockaddr_in addr;
bzero(&addr, sizeof(addr));
addr.sin_family = AF_INET;
addr.sin_port = htons(PORT);
addr.sin_addr.s_addr = htonl(INADDR_ANY);
// bind()
if(bind(sockfd,(struct sockaddr *) &addr, sizeof(addr)) != 0){
cout << "Error - bind() !" << "\n";
return 0;
}
// listen()
if(listen(sockfd, 5) != 0){
cout << "Error - listen() !" << "\n";
return 0;
}
while(1) {
size = sizeof(addr);
client = accept(sockfd, (struct sockaddr *) &addr, &size);
if(client > 0){
cout << "Coonect-" <<inet_ntoa(addr.sin_addr) <<"\n";
char buffer[1024];
bzero(buffer,sizeof(buffer));
recv(client, buffer, sizeof(buffer),0);
if(buffer == "<policy-file-request/>"){
char *mes = "<?xml version='1.0'?><cross-domain-policy><allow-access-from domain='*' to-ports='*' /></cross-domain-policy>";
send(client, mes, strlen(mes)+1, 0);
close(client);
return 1;
}
if(!fork()){
NewClient(client);
}
}
}
}
а вот предупреждение при компиляции
In file included from /usr/include/c++/4.2/backward/iostream.h:31,
from server.cpp:1:
/usr/include/c++/4.2/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the <X> header for the <X.h> header for C++ includes, or <iostream> instead of the deprecated header <iostream.h>. To disable this warning use -Wno-deprecated.
server.cpp: In function 'int main()':
server.cpp:107: warning: deprecated conversion from string constant to 'char*'
по <iostream.h> пытался так <iostream>
тогда вобще ошибок море все на cout указывают .
а 'char*' тоже незнаю как устранить !
Подскажите пожалуйста !