Skip to content

PropTCP_SocketsLayer

rosco-pc edited this page Feb 11, 2015 · 1 revision

Current Beta API:


  Ethernet TCP/IP Socket Layer Driver (IPv4)
  ------------------------------------------

  Copyright (C) 2006 - 2007 Harrison Pham

  This file is part of PropTCP.

  PropTCP is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 3 of the License, or
  (at your option) any later version.

  PropTCP is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program.  If not, see <http://www.gnu.org/licenses/>.

Object "driver_socket" Interface:

PUB  start(cs, sck, si, so, int, xtalout, macptr, ipconfigptr) : okay
PUB  stop
PUB  listen(port)
PUB  connect(ip1, ip2, ip3, ip4, remoteport, localport)
PUB  close(handle)
PUB  isConnected(handle)
PUB  isValidHandle(handle)
PUB  readByteNonBlocking(handle) : rxbyte
PUB  readByte(handle) : rxbyte
PUB  writeByteNonBlocking(handle, txbyte)
PUB  writeByte(handle, txbyte)
PUB  resetBuffers(handle)

Program:   1,798 Longs
Variable:    131 Longs

_____________________________________________________________________
PUB  start(cs, sck, si, so, int, xtalout, macptr, ipconfigptr) : okay

 Call this to launch the Telnet driver
 Only call this once, otherwise you will get conflicts
 macptr      = HUB memory pointer (address) to 6 contiguous mac address bytes
 ipconfigptr = HUB memory pointer (address) to ip configuration block (20 bytes)
               Must be in order: ip_addr. ip_subnet, ip_gateway, ip_dns

_________
PUB  stop

 Stop the driver

_________________
PUB  listen(port)

 Sets up a socket for listening on a port
 Returns handle if available, -1 if none available
 Nonblocking

_______________________________________________________
PUB  connect(ip1, ip2, ip3, ip4, remoteport, localport)

 Connect to remote host
 Returns handle to new socket, -1 if no socket available
 Nonblocking

__________________
PUB  close(handle)

 Closes a connection

________________________
PUB  isConnected(handle)

 Returns true if the socket is connected, false otherwise

__________________________
PUB  isValidHandle(handle)

 Checks to see if the handle is valid, handles will become invalid once they are used
 In other words, a closed listening socket is now invalid, etc

_________________________________________
PUB  readByteNonBlocking(handle) : rxbyte

 Read a byte from the specified socket
 Will not block (returns -1 if no byte avail)

______________________________
PUB  readByte(handle) : rxbyte

 Read a byte from the specified socket
 Will block until a byte is received

_________________________________________
PUB  writeByteNonBlocking(handle, txbyte)

 Writes a byte to the specified socket
 Will not block (returns -1 if no buffer space available)

______________________________
PUB  writeByte(handle, txbyte)

 Write a byte to the specified socket
 Will block until space is available for byte to be sent

_________________________
PUB  resetBuffers(handle)

 Resets send/receive buffers for the specified socket

Clone this wiki locally