# jBASE Sockets

Read Time: 1 minute(s)

jBASE offers some internal functions to gain access to Sockets.  jBASE socket functions are built in C based functions and can be accessed by using DEFC and importing the functions.

  • DEFC VAR SOCKOPEN(handle, ip, port, timeout, setting)
  • DEFC VAR SOCKCLOSE(handle, setting)
  • DEFC VAR SOCKSEND(client_handle, data_to_send, setting)
  • DEFC VAR SOCKRECV(client_handle, recieve_message, setting)
  • DEFC VAR SOCKSERV(port, server_handle, conDetails)
  • DEFC VAR SOCKACCEPT(server_handle, client_handle_number, setting)
  • DEFC VAR SOCKBIND(server_handle, client_handle_number, client_handle, setting)
  • DEFC VAR GETSOCKBASE(server_handle)
  • DEFC VAR GETSERVERHANDLE(server_handle, ctx)

Here is a github project with a good example on how to create both a socket client and server.

https://github.com/zumasys/jbase_sockets (opens new window)

Back to Coding Corner