[Qt-interest] Can two thread share a QAbstractSocket?
Gabriele Kahlout
gabriele at mysimpatico.com
Wed May 12 18:45:41 CEST 2010
And I piggybag two question:
1. Not even a socket descriptor? I'm currently able to pass it through
threads. This is related to the why now question.
2.How can I achieve the wanted behavior:
A server (preferably udp) receives incoming client connections, and then
spawns a thread that deals (receive all requests from that client and serves
them in turn).
The java is:
public void run() {
while (true) {
Socket clientSocket = listener.accept();
new ClientHandler(clientSocket);
}
-----
ClientHandler
public void run() {
while (true) {
String msg = receive();
}
http://code.google.com/p/javatcpchat/source/browse/trunk/src/server/ClientHandler.java
2010/5/12 Gabriele Kahlout <gabriele at mysimpatico.com>
> interesting. Why not?
>
> 2010/5/12 Thiago Macieira <thiago at kde.org>
>
>> Em Quarta-feira 12 Maio 2010, às 17:50:04, Gabriele Kahlout escreveu:
>> > Hello,
>> >
>> > I am trying to have a (udp/tcp) server to pass sockets
>> (socketdescriptor)
>> > to another thread, which communicates with the client and authenticates
>> > it. I'm having several issues, so I was wondering if the above could be
>> > one of them.
>>
>> Answering the subject: no.
>> --
>> Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
>> Senior Product Manager - Nokia, Qt Development Frameworks
>> PGP/GPG: 0x6EF45358; fingerprint:
>> E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358
>>
>> _______________________________________________
>> Qt-interest mailing list
>> Qt-interest at trolltech.com
>> http://lists.trolltech.com/mailman/listinfo/qt-interest
>>
>>
>
>
> --
> Regards,
> K. Gabriele
>
> --- unchanged since 25/1/10 ---
> P.S. Unless a notification (LON), please reply either with an answer OR
> with " ACK" appended to this subject within 48 hours. Otherwise, I might
> resend.
> In(LON, this) ∨ In(48h, TimeNow) ∨ ∃x. In(x, MyInbox) ∧ IsAnswerTo(x, this)
> ∨ (In(subject(this), subject(x)) ∧ In(ACK, subject(x)) ∧
> ¬IsAnswerTo(x,this)) ⇒ ¬IResend(this).
>
> Also note that correspondence may be received only from specified a priori
> senders, or if the subject of this email ends with a code, eg. -LICHT01X,
> then also from senders whose reply contains it.
> ∀x. In(x, MyInbox) ⇒ In(senderAddress(x), MySafeSenderList) ∨ (∃y. In(y,
> subject(this) ) ∧ In(y,x) ∧ isCodeLike(y, -LICHT01X) ).
>
>
--
Regards,
K. Gabriele
--- unchanged since 25/1/10 ---
P.S. Unless a notification (LON), please reply either with an answer OR with
" ACK" appended to this subject within 48 hours. Otherwise, I might resend.
In(LON, this) ∨ In(48h, TimeNow) ∨ ∃x. In(x, MyInbox) ∧ IsAnswerTo(x, this)
∨ (In(subject(this), subject(x)) ∧ In(ACK, subject(x)) ∧
¬IsAnswerTo(x,this)) ⇒ ¬IResend(this).
Also note that correspondence may be received only from specified a priori
senders, or if the subject of this email ends with a code, eg. -LICHT01X,
then also from senders whose reply contains it.
∀x. In(x, MyInbox) ⇒ In(senderAddress(x), MySafeSenderList) ∨ (∃y. In(y,
subject(this) ) ∧ In(y,x) ∧ isCodeLike(y, -LICHT01X) ).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100512/8182ec4f/attachment.html
More information about the Qt-interest-old
mailing list