From: Mads C. <MC...@vo...> - 2002-03-04 07:06:28
|
Hi Ye li! I have only a running version of uC/IP with Ethernet support (NE2000), I haven't tried it with PPP. This means that if any of the PPP layers have any multithreaded dependent code this might be a problem. Notice that I use and older version of the uC/IP stack (one of the first with Ethernet support). There are 3 call-back functions that you must create. These are to be used as arguments to the tcpOpen() function. td = tcpOpen(receiveEvent, transmitEvent, statusEvent); The receiveEvent function will be called everytime there is anything new in the receive buffer. The first argument is the TCP Descriptor and the second argument is the number of bytes in the buffer. The transmitEvent is a bit more tricky (Craig Graham might have posted some new changes to the CVS, the disregard this). Again the first argument is the TCP Descriptor, the second argument is the number of bytes you are allowed to transmit. The last argument may not reflect the real number of bytes that you can transmit (due to buffer limitations in the TCP stack, you might only see this with Ethernet). So when you transmit data with the tcpWrite function always check to see how many bytes was really sent!!! The statusEvent function will be called everytime there is a TCP statechange for the TCP descriptor. The first argument is the TCP Descriptor. The second argument is the old TCP state and the third argument is the new TCP state. If you want to do a printf of the tcp state changes this can be done like this printf("\nuCIP: state (td %d) %s (%d) -> %s (%d)", td, tcbStates[oldState], oldState, tcbStates[newState], newState); If you are not familiar with the TCP states I recommend you read a little about TCP. If it is possible for you to run uC/IP in a multithreaded environment, please do so since this eases programming a lot! For the lastest code please see: http://ucip.sourceforge.net Best wishes, Mads >>> "ye_li" <ye...@an...> 03/04 6:38 >>> hello. I have completed multi-thread version about TCP/IP/PPP stack, but now I have some trouble in one-task version. Can you give me a completed example about it? Many thanks. Best regards Ye li 2002-03-04 |