Initializes Client

   connect('voice.domain.com', 88888)
 Connects to a TeamSpeak 3 server

   connect('voice.domain.com', 88888)
977830
def connect(host = 'localhost', port = 10_011)
      @sock = TCPSocket.new(host, port)

      # Check if the response is the same as a normal teamspeak 3 server.
      if @sock.gets.strip != 'TS3'
        msg = 'Server is not responding as a normal TeamSpeak 3 server.'
        raise InvalidServer, msg
      end

      # Remove useless text from the buffer.
      @sock.gets
    end
40043
function init() {
        // initialize the SDK with the domain where Just is running and the
        // OAuth 2.0 implicit flow parameters
        sdk = new window.JustSDK({
            domain: 'JUSTDOMAIN',
            oauth2: {
                // adapt this to point to the correct domain and path
                redirect_uri: 'https://YOURDOMAIN/browser-app-authorized.html',
                // the client ID of this app. Must have been registered at the
                // Just installation configured under 'domain' above.
                client_id: 'YOUR_CLIENT_ID',
                flow: 'implicit'
            }
        });

        var loginBtn = document.querySelector('#login');
        var logoutBtn = document.querySelector('#logout');

        loginBtn.addEventListener('click', function() {
            printInfo();
        });
        logoutBtn.addEventListener('click', function() {
            window.localStorage.removeItem('just:accessToken:' + sdk.config.domain);
            window.location.reload();
        });
        getToken(false).then(function() {
            logoutBtn.style.display = '';
            loginBtn.style.display = 'none';
            printInfo();
        }, function() {
            loginBtn.style.display = '';
            logoutBtn.style.display = 'none';
        });
    }
583989
public void connect() {
        CommandFactory f = new CommandFactory();
        f.addTrainerInitCommand();
        initMessage = f.next();
        super.start();
        super.setName("Trainer");
    }
1246681
def setHTTPConnectionAndqbhost( useSSL, org = "www", domain = "quickbase", proxy_options = nil )
      setHTTPConnection( useSSL, org, domain, proxy_options )
      setqbhost( useSSL, org, domain )
   end
355323
def init_http_client(options)
        http = Net::HTTP.new(@base_uri.host, 443)
        http.use_ssl = true if @base_uri.scheme == "https"
        http.verify_mode = OpenSSL::SSL::VERIFY_NONE # FIXME: not 100% supported
        self.http_client = http
      end
509739
def setHTTPConnection( useSSL, org = "www", domain = "quickbase", proxy_options = nil )
      @useSSL = useSSL
      @org = org
      @domain = domain
      if USING_HTTPCLIENT
        if proxy_options
           @httpConnection = HTTPClient.new( "#{proxy_options["proxy_server"]}:#{proxy_options["proxy_port"] || useSSL ? "443" : "80"}" )
           @httpConnection.set_auth(proxy_options["proxy_server"], proxy_options["proxy_user"], proxy_options["proxy_password"])
        else  
           @httpConnection = HTTPClient.new 
        end
      else  
        if proxy_options
           @httpProxy = Net::HTTP::Proxy(proxy_options["proxy_server"], proxy_options["proxy_port"], proxy_options["proxy_user"], proxy_options["proxy_password"])
           @httpConnection = @httpProxy.new( "#{@org}.#{@domain}.com", useSSL ? 443 : 80)
        else
           @httpConnection = Net::HTTP.new( "#{@org}.#{@domain}.com", useSSL ? 443 : 80 )
        end  
        @httpConnection.use_ssl = useSSL
        @httpConnection.verify_mode = OpenSSL::SSL::VERIFY_NONE
      end
   end
824480
function initClient() {

    var scope = "https://www.googleapis.com/auth/cloud-platform https://www.googleapis.com/auth/genomics https://www.googleapis.com/auth/devstorage.read_only https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/drive.readonly";

    let browser;

    igv.google.loadGoogleProperties("https://s3.amazonaws.com/igv.org.app/web_client_google")

        .then(function (properties) {

            return gapi.client.init({
                'clientId': properties["client_id"],
                'scope': scope
            });
        })
        
        .then(function (ignore) {
            gapi.auth2.getAuthInstance().isSignedIn.listen(updateSigninStatus);
        })

        .then(function () {

            var div, options;

            div = $("#myDiv")[0];
            options = {
                genome: "hg19",
                apiKey: igv.google.properties["api_key"],
                queryParametersSupported: true
            };

            igv.createBrowser(div, options)
                .then(function (b) {
                    igv.browser = b;
                })

            
        })

    //
    // function handleSignInClick(event) {
    //     // Nothing to do
    // }

    function updateSigninStatus(isSignedIn) {

        if (isSignedIn) {
            //$("#signInButton").hide();

            var user = gapi.auth2.getAuthInstance().currentUser.get();
            var profile = user.getBasicProfile();
            var username = profile.getName();
            $("#switchUserLink").html("Logged in as: " + username);

        }

    }

}
174704
def connection
      @options[:path] =API_VERSION1+ @options[:path]
      @options[:headers] = HEADERS.merge(@options[:headers])

      Megam::Log.debug("HTTP Request Data:")
      Megam::Log.debug("> HTTP #{@options[:scheme]}://#{@options[:host]}")
      @options.each do |key, value|
        Megam::Log.debug("> #{key}: #{value}")
      end
      Megam::Log.debug("End HTTP Request Data.")
      @connection = Excon.new("#{@options[:scheme]}://#{@options[:host]}",@options)
    end
332242
def get_client
      init_opts = {
        client_id:     @CLIENT_ID,
        client_secret: @CLIENT_SECRET
      }

      if username? and password?
        init_opts[:username] = @USERNAME
        init_opts[:password] = @PASSWORD
      end

      Soundcloud.new(init_opts)
    end
59047
function Connection(options) {
	
	if (!(this instanceof Connection)){
		return new Connection(options);
	}
	
	
	this.prefixCounter = 0;
	this.serverMessages = {};
	this._options = {
		username: options.username || options.user || '',
		password: options.password || '',
		host: options.host || 'localhost',
		port: options.port || 143,
		secure: options.secure === true ? { // secure = true means default behavior
			rejectUnauthorized: false // Force pre-node-0.9.2 behavior
		} : (options.secure || false),
		timeout: options.timeout || 10000, // connection timeout in msecs
		xoauth: options.xoauth,
		xoauth2: options.xoauth2
	};
	
	this._messages = {};
	this._messages = {};
	
	if (options.debug===true){
		this.debug = function(msg){
			console.log(msg);
		}
	}
	
		
	if (options.chainDebug===true){
		this.chainDebug = function(msg){
			console.log(msg);
		}
	}
	
	this.socket = null;
	
	this._messages_prefix_key={};
	this._messages_key_prefix={};
	this._messages={};
	
	
	this._msg_buffer = '';
	this._resetChainCommands();
}
1123492
def connect(self, *args):
        """"""

        self.log("Connect ", args, lvl=verbose)

        try:
            sock = args[0]
            ip = args[1]

            if sock not in self._sockets:
                self.log("New client connected:", ip, lvl=debug)
                clientuuid = str(uuid4())
                self._sockets[sock] = Socket(ip, clientuuid)
                # Key uuid is temporary, until signin, will then be replaced
                #  with account uuid

                self._clients[clientuuid] = Client(
                    sock=sock,
                    ip=ip,
                    clientuuid=clientuuid,
                )

                self.log("Client connected:", clientuuid, lvl=debug)
            else:
                self.log("Old IP reconnected!", lvl=warn)
                #     self.fireEvent(write(sock, "Another client is
                # connecting from your IP!"))
                #     self._sockets[sock] = (ip, uuid.uuid4())
        except Exception as e:
            self.log("Error during connect: ", e, type(e), lvl=critical)
537062
def connect(host, port, username, password):
        """"""
        # Instantiate ftplib client
        session = ftplib.FTP()

        # Connect to host without auth
        session.connect(host, port)

        # Authenticate connection
        session.login(username, password)
        return session
1012610
void doMain(String[] args, boolean throwOnError) throws Exception {
		if (args.length == 0) {
			usage(throwOnError, "no arguments specified");
			return;
		} else if (args.length > 2) {
			usage(throwOnError, "improper number of arguments:" + Arrays.toString(args));
			return;
		}

		// check for --usage or --help
		if (args.length == 1 && ("--usage".equals(args[0]) || "--help".equals(args[0]))) {
			usage(throwOnError, null);
			return;
		}

		CommandLineJmxClient jmxClient;
		if (args[0].indexOf('/') >= 0) {
			jmxClient = new CommandLineJmxClient(args[0]);
		} else {
			String[] parts = args[0].split(":");
			if (parts.length != 2) {
				usage(throwOnError, "argument should be in 'hostname:port' format, not: " + args[0]);
				return;
			}
			String hostName = parts[0];
			int port = 0;
			try {
				port = Integer.parseInt(parts[1]);
			} catch (NumberFormatException e) {
				usage(throwOnError, "port number not in the right format: " + parts[1]);
				return;
			}
			jmxClient = new CommandLineJmxClient(hostName, port);
		}

		if (args.length == 1) {
			jmxClient.runCommandLine();
		} else if (args.length == 2) {
			jmxClient.runBatchFile(new File(args[1]));
		}
	}
1053385
function ServerConnect (socket) {
        var simulator= this.simulator;

        socket.uid = "Socket://" + socket.remoteAddress +":" + socket.remotePort;
        socket.num = CLsockid ++;
        simulator.Debug(3, "New Client Id-%d Server=[%s] Client: [%s]",CLsockid,this.uid,socket.uid);

        // keep track of active clients inside TCP server
        ActiveClients[socket.num] = socket;

        // Normaly gpsd client does not talk to server
        socket.on("data", function(buffer) {
            simulator.Debug(1, "%s Data=[%s]", socket.uid, buffer);
            socket.write ('GeoGate Simulator Ignored:' + buffer );
        });

        // On error close socket
        socket.on('error', function (err) {
            simulator.Debug(1, "%s ERROR=[%s]", socket.uid, err);
            socket.end();
        });

        // Remove the device from daemon active device list and notify adapter for eventual cleanup
        socket.on('end', function () {
            simulator.Debug(3, "Tcp-Client Quit %s/%d uid=%s", socket.countid, simulator.clientCount, socket.uid);
            delete ActiveClients[socket.num];
        });
    }
1035744
def connect(self, host, port=6667, password=None):
        
        # Prepare the callbacks
        self._irc.add_global_handler('all_events', self.__handler)

        # Prepare the connection
        self._connection = self._irc.server().connect(
            host, port, self._nickname, password,
            self._username, self._realname)

        # Start connection thread
        self.__stopped.clear()
        self.__thread = threading.Thread(target=self.__loop,
                                         name="IRC-Bot-Loop")
        self.__thread.daemon = True
        self.__thread.start()
752873
public function loginAction()
  {
    $this->setNoRender();

    /* grab user parameters from $_REQUEST array */
    $host = TeamSpeak3_Helper_Uri::getUserParam("hostaddr");
    $port = TeamSpeak3_Helper_Uri::getUserParam("hostport");
    $user = TeamSpeak3_Helper_Uri::getUserParam("username");
    $pass = TeamSpeak3_Helper_Uri::getUserParam("password");

    try
    {
      /* fallback to default values */
      if(empty($host)) throw new Exception("Please enter a valid server address.");
      if(empty($port)) throw new Exception("Please enter a valid server port.");
      if(empty($user)) throw new Exception("Please enter a valid username.");
      if(empty($pass)) throw new Exception("Please enter a valid password.");

      /* validate host address */
      if(ip2long($host) === FALSE)
      {
        $addr = gethostbyname($host);

        if($addr == $host)
        {
          throw new Exception("Unable to resolve IPv4 address for hostname '" . $host. "'.");
        }

        $host = $addr;
      }

      /* set custom ServerQuery nickname and connect to server */
      $displayname = rawurlencode("TS3 PHP Framework Demo #" . mt_rand(1, 999999));
      $serverquery = TeamSpeak3::factory("serverquery://" . $user . ":" . $pass . "@" . $host . ":" . $port . "/?nickname=" . $displayname . "#use_offline_as_virtual");
    }
    catch(Exception $e)
    {
      /* save catched error mesage */
      $this->setLastEvent($e->getMessage(), TRUE);

      /* goto loginAction() */
      $this->redirect("login");
    }

    /* write session variables */
    $_SESSION["_logintime"] = time();
    $_SESSION["_serverqry"] = serialize($serverquery);
    $_SESSION["_loginname"] = $user;

    /* goto indexAction() */
    $this->redirect("index");
  }
165561
function init(options){
	options = util._extend({ssl:null, port:12345}, options);
	var serverWorkers = {}; // save main server sockets
	var clientSocket = []; // save local server socket
	var clientOptions = []; // save optioin obj
	var wsServer;
	if(options.ssl)
		wsServer = require('https').createServer(options.ssl);
	else wsServer = require('http').createServer();
	var io = require('socket.io')(wsServer);
	
	if(options.auth)	
	io.set('authorization', function (handshakeData, callback) {
		if(handshakeData.url.match('username='+options.auth.username+'&password='+options.auth.password))
        	callback(null, true); // error first callback style 
        else callback('no auth', false);
    });

	io.on('connection', function(socket){
		// 0. save server sockets & local socket
		socket.on('init', function(data){
			if(data._type == 'localServer'){
				socket._type = 'localServer';
				if(clientSocket.length>0)
					clientSocket.slice(-1)[0].emit('hold');			
				// then handle new one
				clientSocket.push(socket);
				clientOptions.push(data);
				// inform server the new client
				for(i in serverWorkers)
					serverWorkers[i].emit('client', data);
			}else if(data._type == 'server'){
				socket._type = 'server';
				serverWorkers[socket.id] = socket;
			}else{
				// ignore this connection
			}
		})
		// handle req from server, relay data to client
		socket.on('req', function(data){
			if(clientSocket.length > 0){
				data._sid = socket.id;
				clientSocket.slice(-1)[0].emit('req', data)
			}
		})
		// handle res from client, relay the data to the server
		socket.on('res', function(data){
			if(serverWorkers[data._sid])
				serverWorkers[data._sid].emit('res', data);
		});
		socket.on('disconnect', function(reason){
			if(socket._type == 'localServer'){
				var last = false;
				for(i in clientSocket){
					if(socket.id == clientSocket[i].id){
						if(i == clientSocket.length-1)
							last = true;
						clientSocket.splice(i, 1);
						clientOptions.splice(i,1);
						break;
					}
				}
				if(clientSocket.length > 0 && clientOptions.length > 0){
					if(last)
						clientSocket.slice(-1)[0].emit('back');	
					for(i in serverWorkers)
						serverWorkers[i].emit('client', clientOptions.slice(-1)[0]);
				}
				else
					for(i in serverWorkers)
						serverWorkers[i].emit('client', false);
			}
			else if(socket._type == 'server')
				delete serverWorkers[socket.id];
		});
	});
	wsServer.listen(options.port).on('listening', function(){
		options.listening ? options.listening() : noop();
		//console.log('[NLT] Server is ready on port ' + options.port);
	}).on('error', function(e){
		options.error ? options.error(e) : noop();
		//console.log('[NLT] Setup error', e)
	});
}