TCPObject

Engine/source/app/net/tcpObject.h

More...

Public Types

enum
State {
  Disconnected 
  DNSResolved 
  Connected 
  Listening 
}

Private Types

enum
_Anonymous_ {
  TableSize = 256
  TableMask = 0xFF
}

Protected Types

Parent 

Private Attributes

Private Static Attributes

table [TableSize]

Protected Attributes

Public Functions

connect(const char * address)
DECLARE_CALLBACK(bool , onPacket , (const char *data) )
DECLARE_CALLBACK(void , onConnectionRequest , (const char *address, const char *ID) )
DECLARE_CALLBACK(void , onEndReceive , () )
DECLARE_CALLBACK(void , onLine , (const char *line) )
listen(U16 port)
bool

Called when the object is added to the sim.

onReceive(U8 * buffer, U32 bufferLen)
parseLine(U8 * buffer, U32 * start, U32 bufferLen)
bool

Process constructor options. (ie, new SimObject(1,2,3))

bool
processLine(UTF8 * line)
send(const U8 * buffer, U32 bufferLen)
bool
sendFile(const char * fileName)

Send an entire file over tcp.

Public Static Functions

Detailed Description

Public Types

State

Enumerator

Disconnected
DNSResolved
Connected
Listening

Private Types

@44

Enumerator

TableSize = 256
TableMask = 0xFF

Protected Types

typedef SimObject Parent 

Private Attributes

TCPObject * mNext 
State mState 
NetSocket mTag 

Private Static Attributes

TCPObject * table [TableSize]

Protected Attributes

U8 * mBuffer 
U32 mBufferSize 
U16 mPort 

Public Functions

TCPObject()

~TCPObject()

addToTable(NetSocket newTag)

connect(const char * address)

DECLARE_CALLBACK(bool , onPacket , (const char *data) )

DECLARE_CALLBACK(void , onConnected , () )

DECLARE_CALLBACK(void , onConnectFailed , () )

DECLARE_CALLBACK(void , onConnectionRequest , (const char *address, const char *ID) )

DECLARE_CALLBACK(void , onDisconnect , () )

DECLARE_CALLBACK(void , onDNSFailed , () )

DECLARE_CALLBACK(void , onDNSResolved , () )

DECLARE_CALLBACK(void , onEndReceive , () )

DECLARE_CALLBACK(void , onLine , (const char *line) )

DECLARE_CONOBJECT(TCPObject )

disconnect()

emptyBuffer()

finishLastLine()

getState()

isBufferEmpty()

listen(U16 port)

onAdd()

Reimplemented from: SimObject

onConnected()

Reimplemented by: HTTPObject

onConnectFailed()

Reimplemented by: HTTPObject

onConnectionRequest(const NetAddress * addr, U32 connectId)

onDisconnect()

Reimplemented by: HTTPObject

onDNSFailed()

onDNSResolved()

onReceive(U8 * buffer, U32 bufferLen)

Reimplemented by: HTTPObject

parseLine(U8 * buffer, U32 * start, U32 bufferLen)

processArguments(S32 argc, ConsoleValueRef * argv)

Reimplemented from: SimObject

processLine(UTF8 * line)

Reimplemented by: HTTPObject

removeFromTable()

send(const U8 * buffer, U32 bufferLen)

sendFile(const char * fileName)

Send an entire file over tcp.

  • fileName Full path to file you want to send

    return:

    true if file was sent, false if not (file doesn't exist)

setPort(U16 port)

Public Static Functions

find(NetSocket tag)