Data Structures |
struct | BCS_TCP_connection |
| Struct representing a connection. More...
|
struct | BCS_TCP_package |
| Struct representing a network package. More...
|
Enumerations |
enum | BCS_TCP_ids {
BCS_TCP_MS3_CAN,
BCS_TCP_BOARD_CAN,
BCS_TCP_PIN_IO,
BCS_TCP_DISPLAYMSG,
BCS_TCP_TELESEED
} |
| Enum containing package ids.
More...
|
Functions |
Int32 | BCS_TCP_closeConnection (BCS_TCP_connection *c) |
| Closes an exisiting connection and stops listening at the port selected when calling BCS_TCP_waitForConnection.
|
Int32 | BCS_TCP_create (BCS_TCP_package *p) |
| Initializes a BCS_TCP_package variable.
|
Int32 | BCS_TCP_delete (BCS_TCP_package *p) |
| Deletes and frees a BCS_TCP_package.
|
BCS_TCP_ids | BCS_TCP_getID (BCS_TCP_package *p) |
| Gets the id of a package.
|
Int32 | BCS_TCP_getSize (BCS_TCP_package *p) |
| Gets the current size of a package's datablock.
|
char | BCS_TCP_readChar (BCS_TCP_package *p) |
| Reads a char from a received BCS_TCP_package.
|
Int32 | BCS_TCP_readInt (BCS_TCP_package *p) |
| Reads an int from a received BCS_TCP_package.
|
Int16 | BCS_TCP_readShort (BCS_TCP_package *p) |
| Reads a short from a received BCS_TCP_package.
|
Int32 | BCS_TCP_receive (BCS_TCP_connection *c, BCS_TCP_package *p) |
| Receives a package over a given connection.
|
Int32 | BCS_TCP_send (BCS_TCP_connection *c, BCS_TCP_package *p) |
| Sends a filled package over a given connection.
|
void | BCS_TCP_setID (BCS_TCP_package *p, BCS_TCP_ids id) |
| Sets the id of a package.
|
Int32 | BCS_TCP_waitForConnection (const char *port, BCS_TCP_connection *c) |
| When called this function will listen at the given port (just like a server) for incoming connection requests.
|
void | BCS_TCP_writeChar (BCS_TCP_package *p, char c) |
| Writes a char to an exisiting BCS_TCP_package.
|
void | BCS_TCP_writeInt (BCS_TCP_package *p, Int32 i) |
| Writes an int to an existing BCS_TCP_package.
|
void | BCS_TCP_writeShort (BCS_TCP_package *p, Int16 i) |
| Writes a short to an existing BCS_TCP_package.
|
- Date:
- 16.04.2009
- Author:
- Marius Zwicker This file provides server capabilities and package handling methods for tcp/ip transmission. Its counterpart is the connector class implemented in Java. All methods work according to the erb lan protokoll, i.e. a package consists of an id (2 bytes), size (4 bytes) and a datablock (length specified in size).
2 || 4 || ...
Transferring data should be handled the following way:
- declare and initialize a package
- set its id
- write data into this package
- send it
- delete the package
When receiving a package everything happens the other way round
- receive a package
- get its id
- read data out of this package
- delete the package
Data can be read in the same order as it was written.
NOTE: You can't read from a package you created and can't write to a package you received. Still receiving and sending the same package is possible.