#include "ServerSocket.h"
#include "SocketException.h"
#include <string>
#include<iostream>
int main(int argc, int argv[])
{
std::cout << "running....\n";
try
{
// Create the socket
ServerSocket server ( 30000 );
while ( true )
{
ServerSocket new_sock;
server.accept ( new_sock );
try
{
while ( true )
{
std::string data;
new_sock >> data;
new_sock << data;
}
}
catch ( SocketException& ) {}
}
}
catch ( SocketException& e )
{
std::cout << "Exception was caught:" << e.description() << "\nExiting.\n";
}
return 0;
}
views:
151answers:
3
+1
A:
The signature for main
should be:
int main(int argc, char **argv)
or
int main(int argc, char *argv[])
Matt Joiner
2010-03-06 08:30:24
thanks the problem hav been resolve
Raja
2010-03-06 09:20:37
+1
A:
replace: int main(int argc, int argv[])
with: int main(int argc, char* argv[])
SuperShabam
2010-03-06 08:31:10
+2
A:
Honestly,
int main(int argc, int argv[])
is nonsense. Where did you find that?
This is the second question with the almost exact same title that is completely unrelated to socket programming. Do not try to do socket programming if you don't have a running hello world application.
This question is not related to linux nor to sockets, this is plain c++.
mnemosyn
2010-03-06 08:32:16