Skip to content

parsidev/TCP-Socket

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Laravel TCP Socket

installation

For install this package Edit your project's composer.json file to require parsidev/tcp-socket

"require": {
    "parsidev/tcp-socket": "dev-master"
},

Now, update Composer:

composer update

Once composer is finished, you need to add the service provider. Open config/app.php, and add a new item to the providers array.

'Parsidev\Socket\SocketServiceProvider',

Next, add a Facade for more convenient usage. In config/app.php add the following line to the aliases array:

'Socket' => 'Parsidev\Socket\Facades\Socket',

Publish config files:

php artisan vendor:publish --provider="Parsidev\Socket\SocketServiceProvider"

for change username, password and other configuration change config/tcpsocket.php

Usage

Configuration

Open config/tcp-socket.php

Enter Server Ip Address and Port
You can change server protocol between SOL_TCP and SOL_UDP

Connect To Server

$socket = Socket::connect();

$socket = Socket::connect($ip);
$socket = Socket::connect(null, $port);
$socket = Socket::connect($ip, $port);

Disconnect from Server

Socket::disconnect($socket);

Send Message

Socket::sendMessage('test message'); //send message to connected server
Socket::sendMessageTo('test message', 'server ip', server port) // send message to a socket

About

No description, website, or topics provided.

Resources

License

Apache-2.0, GPL-3.0 licenses found

Licenses found

Apache-2.0
LICENSE
GPL-3.0
LICENSE.txt

Stars

Watchers

Forks

Packages

No packages published

Languages