ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
mizio.cpp: In member function `void Mizio::Check_Proxies()':
* mizio.cpp:52: no matches converting function `Mizio_Server' to type ` void*(*)(void*)'
* mizio.h:37: candidates are: void* Mizio::Mizio_Server(void*)
* mizio.cpp: In member function `void* Mizio::Mizio_Server(void*)':
* mizio.cpp:118: no matches converting function `Mizio_Client' to type ` void*(*)(void*)'
* mizio.h:38: candidates are: void* Mizio::Mizio_Client(void*)
I red somewhere I have to use some wrappers but my knowledge of C++ is not so good, could someone help me so I understand the problem ?
>The new thread has to be static, so you can try declaring the function as static, but i dont think that will help.
Thank you for your kind answer, so how did you solve your problem ? Around the web there are some libraries but I don't want to install a new library, just some hints on how to succed the compilation.
void* Mizio_Server ( void* dummy)
{
Mizio* pThis = NULL;
pThis = (Mizio *)dummy;
pthread_t Client_Thread;
int Server_Socket;
int accepted_socket;
int size;
struct sockaddr_in port_addr, accept_addr;
int set_opt = 1;
fd_set read_set;
int ready_fd;
/* set up the socket on the server port */
port_addr.sin_family = AF_INET;
port_addr.sin_addr.s_addr = htonl( INADDR_ANY );
port_addr.sin_port = htons( SERVER_PORT );
Server_Socket = socket( AF_INET, SOCK_STREAM, IPPROTO_TCP );
setsockopt( Server_Socket, SOL_SOCKET, SO_REUSEADDR, (char*)&set_opt, sizeof( set_opt ) );
if ( bind(Server_Socket, (struct sockaddr*)&port_addr, sizeof( port_addr )) > 0 )
{
while(1)
{
listen( Server_Socket, 5 ); // wait for the client to try to connect
FD_ZERO( &read_set );
FD_SET( Server_Socket, &read_set );
// a client has connected. Accept their connection and create a thread to serve the client
size = sizeof( accept_addr );
accepted_socket = accept( Server_Socket, (struct sockaddr*)&accept_addr, &size );
pthread_create( &Client_Thread, NULL, Mizio_Client, (void*)accepted_socket );
}
}
else
{
KMessageBox::error( pThis->Mizio_View, "Can't open port 80, maybe another program is using it or you are not root !");
pthread_exit( 0 );
}
}
//So now I have to create a thread for each connected client. I need the same arguments in the Mizio_Server function plus the argument accepted_socket:
How to have the QWidget (passed with 'this' in Mizio_Server) in this function ?
I red that I can use struct but the compiler keeps giving me syntax error when
I try to use struct_name.mizio_QWidget_pointer_name
Any idea ?? What if I send you the whole package .tar.gz by email ?
You will need QT, XFree and KDE headers to compile it.
You are right, I have to send the whole structure but I have to fill the variable accepted_socket first right ? So I can use it later, but why do I get the error message ? Also do you know a link or a book that explains those arabic error messages the compiler outputs ?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.