[En-Nut-Discussion] Generating socket events
Trevor O'Grady
togrady at comtech.uk.com
Thu Oct 28 19:43:45 CEST 2004
Thanks for your response Matthias.
I presume I could initiate a new thread that opens the socket, blocks until
it connects, generates a connect event when connected, blocks for reception,
generates a receive event. The same thread would be able to generate the
close event. I could pass a socket identifier to the thread on creation that
could be used as the socket id for the event functions.
The only thing I can't see how to do is generate the socket ready to
transmit more data event. How does NUT handle the situation where you want
to send a lot of data over a slow link (e.g. ppp) - does NutTcpSEnd block
until it has sent a packet or something?
Regards
Trevor
-----Original Message-----
From: Matthias Ringwald [mailto:mringwal at inf.ethz.ch]
Sent: 27 October 2004 08:50
To: togrady at ntlworld.com; Ethernut User Chat (English)
Subject: Re: [En-Nut-Discussion] Generating socket events
hi trevor
there's no direct way to have nut/os call your event handler, but you
can always create one (or more threads) to realize that
your socket events occured (I've never used an ethernut board or tcp/ip
btw) and call your handlers. If you need more than one
thread you should think about using a NutMutex to assure only one
handler is processed at a time.
matthias
On 27.10.2004, at 01:16, Trevor O'Grady wrote:
>
> I have an existing FTP client that works over an event driven OS and
> hence is implemented as a state machine. Is there a way to get
> ETHERNUT to generate the socket events so that I don't have to rewrite
> my code to use blocking functions? These are the sort of event
> functions I need to call in my code when socket events occur.
>
> ftpSocketConnectEv( int socket )
> ftpSocketDataInEv( int socket, char *data, int len )
> ftpSocketDataSendEv( int socket )
> ftpScoketCloseEv( int Socket )
>
> I know this is not how ETHERNUT normally works but it would be a shame
> not to be able to use code that is tested and working. Any help
> greatly appreciated.
>
> Regards
> Trevor
>
> _______________________________________________
> En-Nut-Discussion mailing list
> En-Nut-Discussion at egnite.de
> http://www.egnite.de/mailman/listinfo.cgi/en-nut-discussion
---
More information about the En-Nut-Discussion
mailing list