Jump to: navigation, search

Mihini/socket

< Mihini
Revision as of 07:04, 11 March 2015 by Niranjan.babu.in.bosch.com (Talk | contribs) (Created page with "== SOCKET == '''TCP example:-''' '''Variables''' local sched = require 'sched' local socket = require 'socket' '''Main function''' local function main() local tcpSo...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

SOCKET

TCP example:- Variables

local sched = require 'sched'
local socket = require 'socket'

Main function

local function main()
  local tcpSocket= socket.bind("ip-address",8090)
    while true do
       data=tcpSocket:receive('*a')
       print(data)
    end
end

UDP Socket

Variables

local sched = require 'sched'
local socket = require 'socket'

Main function

local function main()
  local tcpSocket= socket.bind("ip-address",8090)
   while true do
     data=tcpSocket:receive('*a')
     print(data)
  end
end