whiplk

[CODE] - Sockets(function)

Nov 13th, 2012
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.38 KB | None | 0 0
  1. //By: Jeffrey_Hatrix, Willian_Luigi
  2.  
  3. <?php
  4. socket("127.0.0.1", 7777, "Bytes a enviar");
  5.  
  6.  
  7. function socket($ip_vis, $port, $pack) {
  8.     $socket;
  9.  
  10.     if (!ereg($ip_vis, $ip_sv)) {  
  11.         if ($socket = socket_create(AF_INET, SOCK_STREAM, 0)) {
  12.             if (socket_connect($socket, $ip_vis, $port)) {
  13.                 socket_write($socket, $pack, strlen($pack));
  14.                 return true;
  15.             }
  16.         }
  17.     }
  18. }
  19.  
  20. ?>
Advertisement
Add Comment
Please, Sign In to add comment