Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 4

Qt-interest Archive, March 2002
qsocket-problem


Message 1 in thread

Hallo!

I have a little problem with qsocket.

I send an authorisation-request to the server. The server sends me "wrong
password". It is okay. I have written the wrong one. When i start the request
again the application crashs: "Segmentation fault". The socket-state is
unknown (25970).

when i have written the right password the socket-state change to idle
after receiving request.

where is my error.


-- snip --
/* -- connectToHost --
 * connecting to host
 */
void MyQSocket::connectToHost() {
#ifdef DEBUG
	cout << "MyQSocket::connectToHost" << endl;
#endif

	socket->connectToHost(host, port);

	emit status(tr("Connecting to host %1:%2").arg(host).arg(port));

}

/* -- authenticate --
 * authenticate on the server
 */
void MyQSocket::authenticate(const void *message, int bytes) {
#ifdef DEBUG
	cout << "MyQSocket::authenticate" << endl;
#endif

	this->message = (void *)message;
	this->bytes = bytes;
	todo = STDAuthenticate;

	StrMyCompanyClientSend test;
	strcpy(test.name, "michael");
	strcpy(test.password, "secret");
	test.doCode = doAuthenticate;;
	strcpy(test.message, "test");

	socket->writeBlock((const char *)(this->message), (Q_ULONG)bytes);

	emit status(tr("Authenticate on the server"));

}
-- snip --
-- 
 [ signature omitted ] 

Message 2 in thread

On Mon, Mar 11, 2002 at 08:35:54PM +0100, Michael Ott wrote:
Hallo!

I forget something.

My system: linux qt3-3.0.1 gcc3
> 
> I have a little problem with qsocket.
> 
> I send an authorisation-request to the server. The server sends me "wrong
> password". It is okay. I have written the wrong one. When i start the request
> again the application crashs: "Segmentation fault". The socket-state is
> unknown (25970).
> 
> when i have written the right password the socket-state change to idle
> after receiving request.
> 
> where is my error.
> 
> 
> -- snip --
> /* -- connectToHost --
>  * connecting to host
>  */
> void MyQSocket::connectToHost() {
> #ifdef DEBUG
> 	cout << "MyQSocket::connectToHost" << endl;
> #endif
> 
> 	socket->connectToHost(host, port);
> 
> 	emit status(tr("Connecting to host %1:%2").arg(host).arg(port));
> 
> }
> 
> /* -- authenticate --
>  * authenticate on the server
>  */
> void MyQSocket::authenticate(const void *message, int bytes) {
> #ifdef DEBUG
> 	cout << "MyQSocket::authenticate" << endl;
> #endif
> 
> 	this->message = (void *)message;
> 	this->bytes = bytes;
> 	todo = STDAuthenticate;
> 
> 	StrMyCompanyClientSend test;
> 	strcpy(test.name, "michael");
> 	strcpy(test.password, "secret");
> 	test.doCode = doAuthenticate;;
> 	strcpy(test.message, "test");
> 
> 	socket->writeBlock((const char *)(this->message), (Q_ULONG)bytes);
> 
> 	emit status(tr("Authenticate on the server"));
> 
> }
> -- snip --
> -- 
> See you
> 
>   Michael Ott
> 
> /----------------------------\       .--.
> |         Michael Ott        |      |o_o | 
> |      Glockenhofstr 29 a    |      ||_/ |
> |        90478 Nuernberg     |     //   \ \
> | e-mail: ZolnOtt@NEFkom.net |    (|     | )
> |  Tel. +49 9 11 41 88 576   |   /'\_   _/`\
> \----------------------------/	 \___)=(___/
> 
> LINUX and you have much fun
> 

-- 
 [ signature omitted ]