C Language Development Kit/Functions/NetO Transmit
From OptiWiki
| Availability | All terminals | ||||||||||||||||||||
| Description | This routine uses the NetO protocol to transmit one or more complete files through the serial communications port that was last opened by comopen(). The NetO protocol is especially suited for a network environment. | ||||||||||||||||||||
| Syntax | int neto_transmit(char (*filename)[MAX_FNAME], int filecount,char *term_id, int tkey, int ypos); int neto_transmit2(char (*filename)[MAX_FNAME], int filecount, char *term_id, unsigned int timeout, int tkey, int ypos); Note:
On the OPH 100x and H 13, | ||||||||||||||||||||
| Arguments |
char (*filename)[MAX_FNAME] An array of strings, each string containing up to twelve characters plus the null character.
Each string contains the name of the file that is to be transmitted.
int filecountThe number of files to be transmitted. There must be at least filecount strings in filename.
char *term_id Points to a string containing the name (or: ID) of the terminal. The string can have a maximum of 6 characters.
unsigned int timeout timeout is the maximum time that may pass between calling the function and receiving a valid poll from the PC. Once a valid poll has been received, the protocol takes over and another time-out mechanism starts. The protocol specifies that when 3 seconds pass without receiving an answer from the PC a time-out error occurs.
int tkeyValue for the termination key. When the user presses this key the file reception will terminate. Specify a non-existing value, e.g. -1, when you do not want to give the user the option to terminate file reception.
int yposThe y position (in character coordinates) of the progress bar. Use | ||||||||||||||||||||
| Returns | OK on success or an error code (negative value) specified as follows:
| ||||||||||||||||||||
| Remarks | When these functions draw the progress bar, they change the cursor settings to AUTOWRAP, See the cursor() function for details.
Important:
| ||||||||||||||||||||
| Example | // To use the following example the user must have access to a NetO protocol // upload and download utility on the host. The application first tries to receive // up to two files, and next tries to transmit the same file(s) back. // // The ENT key can be used to terminate the file reception/transmission. // // The terminal is assigned the terminal ID "123456". The terminal ID can be used to // distinguish the terminal from other terminals in a network. #include <stdio.h> #include "lib.h" void main( void ) { #ifdef OPH // OPH is defined when the code is build for the OPH1003 (So not for the OPH1004) char ftest[10][16]; // Array for ten filenames; static not required for OPH1003 #else static char ftest[10][13]; // Array for ten filenames; static so space is not on stack #endif int test; systemsetting("K7"); // 19200bps (N, 8, 1) for(;;) { if( comopen( COM2 ) != OK) // COM2 is the cradle { printf("\fCan't open port"); resetkey(); while( !kbhit()) idle(); continue; } do { printf("\fReceiving.."); test = neto_receive( ftest, "123456", ENT_KEY, 3); printf("\ntest=%d", test); } while( test < 0); comclose( COM2 ); // Saves power printf("\fresult = %d", test); printf("\npress any key"); resetkey(); while( !kbhit()) idle(); if( comopen( COM2 ) != OK) { resetkey(); while( !kbhit()) idle(); continue; } printf("\fTransmitting...\n%d files", test); test = neto_transmit( ftest, test, "123456", ENT_KEY, 3); printf("\fresult = %d", test); printf("\npress any key"); comclose( COM2 ); resetkey(); while( !kbhit()) idle(); } } |
