使用PHP发送到WebSocket服务器?

I'm running a Node.js WebSocket server on port 3000 on the same machine that I'm running Apache/PHP by running a reverse-proxy through Apache. This is my HTTPD file:

  <VirtualHost *:80>
     ProxyRequests off
     SSLProxyEngine on
     ProxyPass /node/ ws://localhost:3000/node/
     ProxyPassReverse /node/ ws://localhost:3000/node/
  </VirtualHost>
  <VirtualHost *:443>
     ProxyRequests off
     SSLProxyEngine on
     ProxyPass /node/ ws://localhost:3000/node/
     ProxyPassReverse /node/ ws://localhost:3000/node/
  </VirtualHost>

Let's say my domain name is "example.com". Then, to connect to the WebSocket server through a browser, I would use this JS:

var connection = new WebSocket("wss://example.com/node/");

This works fine, and I'm successfully sending and receiving messages from browsers.

However, I also need to be able to send (not receive) messages to the WebSocket server using PHP, from the same machine. I've tried several configurations of fsockopen, and none of them have worked. Here are the ones I've tried, with the resulting error messages:

$fp = fsockopen("example.com/node/", 3000); //php_network_getaddresses: getaddrinfo failed: Name or service not known

$fp = fsockopen("ssl://example.com/node/", 3000); //php_network_getaddresses: getaddrinfo failed: Name or service not known

$fp = fsockopen("tls://example.com/node/", 3000); //php_network_getaddresses: getaddrinfo failed: Name or service not known

$fp = fsockopen("http://example.com/node/", 3000); //Unable to find the socket transport "http" - did you forget to enable it when you configured PHP?

$fp = fsockopen("https://example.com/node/", 3000); //Unable to find the socket transport "https" - did you forget to enable it when you configured PHP?

$fp = fsockopen("wss://example.com/node/", 3000); //Unable to find the socket transport "wss" - did you forget to enable it when you configured PHP?

$fp = fsockopen("ws://example.com/node/", 3000); //Unable to find the socket transport "ws" - did you forget to enable it when you configured PHP?

$fp = fsockopen("example.com/node/", 443); //php_network_getaddresses: getaddrinfo failed: Name or service not known

$fp = fsockopen("ssl://example.com/node/", 443); //php_network_getaddresses: getaddrinfo failed: Name or service not known

$fp = fsockopen("tls://example.com/node/", 443); //php_network_getaddresses: getaddrinfo failed: Name or service not known

$fp = fsockopen("http://example.com/node/", 443); //Unable to find the socket transport "http" - did you forget to enable it when you configured PHP?

$fp = fsockopen("https://example.com/node/", 443); //Unable to find the socket transport "https" - did you forget to enable it when you configured PHP?

$fp = fsockopen("wss://example.com/node/", 443); //Unable to find the socket transport "wss" - did you forget to enable it when you configured PHP?

$fp = fsockopen("ws://example.com/node/", 443); //Unable to find the socket transport "ws" - did you forget to enable it when you configured PHP?

$fp = fsockopen("example.com/node/", 80); //php_network_getaddresses: getaddrinfo failed: Name or service not known

$fp = fsockopen("ssl://example.com/node/", 80); //php_network_getaddresses: getaddrinfo failed: Name or service not known

$fp = fsockopen("tls://example.com/node/", 80); //php_network_getaddresses: getaddrinfo failed: Name or service not known

$fp = fsockopen("http://example.com/node/", 80); //Unable to find the socket transport "http" - did you forget to enable it when you configured PHP?

$fp = fsockopen("https://example.com/node/", 80); //Unable to find the socket transport "https" - did you forget to enable it when you configured PHP?

$fp = fsockopen("wss://example.com/node/", 80); //Unable to find the socket transport "wss" - did you forget to enable it when you configured PHP?

$fp = fsockopen("ws://example.com/node/", 80); //Unable to find the socket transport "ws" - did you forget to enable it when you configured PHP?

I've also tried all of those configurations using "localhost" and "127.0.0.1". And I've also experimented using the built-in PHP library functions socket_create and socket_connect, with all of those same hostnames, IP's, and ports - all resulting in the same types of "unknown host" errors. What am I doing wrong? What is the right way to do this?

duanjuan1103
duanjuan1103 这意味着这个问题不是特定于websocket的,而是你正在寻找一个不正确的主机/端口组合。您是否尝试在端口3000上运行标准HTTP服务器并查看是否可以在那里连接?此外,如果您知道节点服务器在端口3000上,那么您尝试所有其他端口的目的是什么?试试telnet127.0.0.13000,让我们知道会发生什么
一年多之前 回复
dqwh1219
dqwh1219 php-websocket客户端类使用相同的fsockopen函数来连接...所以我会遇到与现在相同的问题。
一年多之前 回复
dtnrsmi824877
dtnrsmi824877 查看php-websocketgithub.com/nekudo/php-websocket
一年多之前 回复
douan1893
douan1893 我刚尝试了http和https协议,它们都导致“无法找到套接字传输”错误。
一年多之前 回复
duancao2082
duancao2082 WebSockets是对HTTP/HTTPS的升级,那么尝试使用http或https作为fsockopen函数的参数呢?另外,你为什么要这样做?为什么不在Node.JS服务器中创建一个普通的HTTP/HTTPS端点,并通过Guzzle或Curl从PHP调用它?
一年多之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
将标志发送到websocket服务器

<div class="post-text" itemprop="text"> <p><strong>Problem short (theoretical) :</strong> is it possible to send a flag from one <code>php</code> script to running <code>php</code> script that is used as websocket server to notice about database change?</p> <p><strong>Problem long (theoretical) :</strong> The current app is using websocket already - when user sends a new data (lets assume - <em>message</em>) in <code>client.html</code> it is sent to server <code>server.php</code>, aggregated and written back to the socket. Now the problem occurs: another users sends in data to <code>json.php</code> that does processing and <code>insert|update</code> database table. After that has been done the <code>json.php</code> should warn <code>server.php</code> about the DB change and <code>server.php</code> should send (socket write) to <code>client.html</code>. </p> <p>Similar issues here (code almost identitcal to <a href="https://stackoverflow.com/questions/27960064/php-request-to-php-websocket">1.item</a>)</p> <ol> <li><a href="https://stackoverflow.com/questions/27960064/php-request-to-php-websocket">PHP request to PHP Websocket</a></li> <li><a href="https://stackoverflow.com/questions/19725491/which-is-more-efficient-to-send-websocket-updates-with-a-mysql-database-change">Which is more efficient to send WebSocket updates with a MySQL database change</a></li> <li><a href="https://stackoverflow.com/questions/11524057/push-notifications-in-php-using-amazon-sns-sqs/11552006#11552006">Push notifications in PHP using Amazon SNS/SQS?</a></li> </ol> </div>

Swoole将websocket数据从服务器发送到客户端

<div class="post-text" itemprop="text"> <p><strong>Hi all!</strong></p> <p>I use swoole for WebSockets.</p> <p><strong>I create clietn part:</strong></p> <pre><code>&lt;script&gt; var ws = new WebSocket('ws://site.ll:9502/?user=tester01'); ws.onmessage = function(evt) { console.log(evt.data); }; ws.onopen = function (event) { ws.send('test'); } &lt;/script&gt; </code></pre> <p><strong>Create WebServer part:</strong></p> <pre><code>$server = new swoole_websocket_server("127.0.0.1", 9502); $server-&gt;on("start", function ($server) { echo "Swoole http server is started at http://127.0.0.1:9502 "; }); $server-&gt;on('open', function($server, $req) { echo "connection open: {$req-&gt;fd} "; }); $server-&gt;on('message', function($server, $frame) { echo "received message: {$frame-&gt;data} "; $server-&gt;push($frame-&gt;fd, json_encode(["hello", "world"])); }); $server-&gt;on('close', function($server, $fd) { echo "connection close: {$fd} "; }); $server-&gt;start(); </code></pre> <p><strong>Create send from server part:</strong></p> <pre><code>$client = new swoole_client(SWOOLE_SOCK_TCP); if (!$client-&gt;connect('127.0.0.1', 9502, -1)) { exit("connect failed. Error: {$client-&gt;errCode} "); } $client-&gt;send("hello world "); echo $client-&gt;recv(); $client-&gt;close(); </code></pre> <p>I trying to create TCP server inside WebSocket server, just adding next part inside "on start" callback:</p> <pre><code>$server2 = new swoole_server("127.0.0.1", 9503); $server2-&gt;on('connect', function ($server2, $fd){ echo "connection open: {$fd} "; }); $server2-&gt;on('receive', function ($server2, $fd, $from_id, $data) { $server2-&gt;send($fd, "Swoole: {$data}"); $server2-&gt;close($fd); }); $server2-&gt;on('close', function ($server2, $fd) { echo "connection close: {$fd} "; }); $server2-&gt;start(); </code></pre> <p>But Just receive an error: </p> <blockquote> <p>Swoole\Server::__construct(): eventLoop has already been created. unable to create swoole_server.</p> </blockquote> <p>I need to send data from server to client. How can I do this? In workerman library I doing next: <a href="https://github.com/Shkarbatov/WebSocketPHPWorkerman/blob/master/worker.php" rel="nofollow noreferrer">https://github.com/Shkarbatov/WebSocketPHPWorkerman/blob/master/worker.php</a></p> </div>

向Ratchet PHP Websocket服务器的客户端发送消息

<div class="post-text" itemprop="text"> <p>I am using this server script to create a Websocket server (<code>server.php</code>). This works fine.</p> <pre><code>&lt;?php use Ratchet\MessageComponentInterface; use Ratchet\ConnectionInterface; use Ratchet\Server\IoServer; use Ratchet\Http\HttpServer; use Ratchet\WebSocket\WsServer; use Ratchet\WebSocket\WsServerInterface; require 'vendor/autoload.php'; require_once 'db.php'; class MyClass implements MessageComponentInterface, WsServerInterface { protected $clients; public function __construct() { $this-&gt;clients = new \SplObjectStorage; } public function onOpen(ConnectionInterface $conn) { $this-&gt;clients-&gt;attach($conn); $name = str_replace('/', '', $conn-&gt;httpRequest-&gt;getUri()-&gt;getPath()); $resourceId = $conn-&gt;resourceId; $stmt = $db-&gt;prepare("INSERT INTO clients (id, resourceId, name) VALUES (null, :resourceId, :name)"); $stmt-&gt;bindParam(':resourceId', $resourceId, PDO::PARAM_STR); $stmt-&gt;bindParam(':name', $name, PDO::PARAM_STR); $stmt-&gt;execute(); ConnectDB::closeConnection($db); echo "Connected (" . $resourceId . ") "; } public function onMessage(ConnectionInterface $from, $msg) { $name = str_replace('/', '', $conn-&gt;httpRequest-&gt;getUri()-&gt;getPath()); $request = json_decode($msg); if (json_last_error() === JSON_ERROR_NONE) { require_once 'process.php'; $response = processRequest($msg); if ($response !== false) { $from-&gt;send($response); } } else { $from-&gt;send('JSON error'); $ActionType = 'Connect'; } echo "Incoming message - " $name " "; } public function onClose(ConnectionInterface $conn) { $this-&gt;clients-&gt;detach($conn); echo "Closed "; } public function onError(ConnectionInterface $conn, \Exception $e) { echo "Error: " . $e-&gt;getMessage() . " "; $conn-&gt;close(); } } $server = IoServer::factory( new HttpServer( new WsServer( new MyClass() ) ), 8080 ); $server-&gt;run(); </code></pre> <p>I am saving the ID of <code>$resourceId = $conn-&gt;resourceId;</code> to a database. </p> <p>What I would like to do is have another php script, currently <code>test.php</code> that could send messages to the clients via Ratchet.</p> <p>Here is <code>test.php</code></p> <pre><code>&lt;?php use Ratchet\MessageComponentInterface; use Ratchet\ConnectionInterface; use Ratchet\Server\IoServer; use Ratchet\Http\HttpServer; use Ratchet\WebSocket\WsServer; use Ratchet\WebSocket\WsServerInterface; require 'vendor/autoload.php'; require_once 'db.php'; $to = 119; // hard-coded id, not using database yet $msg = json_encode(array("test" =&gt; "test")); class Sender implements MessageComponentInterface, ConnectionInterface { public function send(ConnectionInterface $to, $msg) { $client = $this-&gt;clients[$to]; $client-&gt;send($msg); } } Sender::send($to, $msg); </code></pre> <p>Error:</p> <pre><code>Fatal error: Declaration of Sender::send() must be compatible with Ratchet\ConnectionInterface::send($data) in test.php on line 20 </code></pre> <p>This does not work and I do not know if this is the correct approach. I don't want to reply to an incoming message (that currently works), rather ultimately send a message from a form at <code>test.php</code>.</p> <p>The Ratchet examples (Hello world) basically use the server to relay the messages between clients. In my case, I only want the server to communicate back and forth to individual clients. Clients never talk to each other. Also, the form at <code>test.php</code> does not create a client, nor does it expect an answer.</p> <p>Can someone steer me in the right direction to send messages directly to clients?</p> </div>

为什么服务器发过来的二进制数据websocket接收不到?

我用if(e) alert(‘abc’)判断e里面什么也没接受到 但是服务器给我发 字符串 或者base64 都可以接收到这是为什么 难道websocket不支持接收 二进制数据吗 还是 我接收的方式不对。

每1秒发送一次WebSocket消息

<div class="post-text" itemprop="text"> <p>I've been tasked settings up the following.</p> <p>6 individual stopwatches which all sync with each other. They all need to be able to start at the same time They need to be able to be stopped separately (6 people will be racing, when one finished, their timer will stop).</p> <p>I'm thinking Web Sockets would be a good idea for this, so the timer can sync with the server, and I've followed <a href="http://www.sitepoint.com/building-live-score-widget-using-php-web-sockets/" rel="nofollow">this</a> to set it up and get it running.</p> <p>I'm currently at the stage where I can connect 6 individuals, and one admin page to display how many clients their are, and a "Start Timer" button.</p> <p>I've created this method which i thought would send the current server time to each client every second (for 10 seconds). But it doesn't work, it sends all 10 messages at once, after 10 seconds.</p> <pre><code>private function startTimer() { for($i = 0;$i &lt; 10;$i++) { $now = date('H:i:s d-m-Y'); foreach($this-&gt;all as $client) { $client['conn']-&gt;send(json_encode(array('action' =&gt; 'time', 'time' =&gt; $now))); } sleep(1); } } </code></pre> <p>So, 1) Are Web Sockets a good way to do this, or, is Javascript/PHP not ideal for doing this project? And 2) If Web Sockets will work, how can I keep each client in sync with each other?</p> </div>

PHP WebSocket ZMQ - 聊天操作 - 将数据发送给特定用户

<div class="post-text" itemprop="text"> <p>im working on a PHP project based on Symfony 2.2.11 and I installed the socketo related to the following tutorial <a href="http://socketo.me/docs/install" rel="nofollow">http://socketo.me/docs/install</a> to make my chat script working.</p> <p><strong>ServerCommand.php</strong> // Code of the command line that starts the WebSocket server</p> <pre><code>$oLoop = Factory::create(); // Listen for the web server to make a ZeroMQ push after an ajax request $oContext = new Context($oLoop); $oPull = $oContext-&gt;getSocket(\ZMQ::SOCKET_PULL); // LET IT 127.0.0.1 $oPull-&gt;bind('tcp://127.0.0.1:5555'); // Binding to 127.0.0.1 means the only client that can connect is itself $oPull-&gt;on('message', array($oChat, 'onMessage')); // Set up our WebSocket server for clients wanting real-time updates $oWebSock = new Server($oLoop); $oWebSock-&gt;listen(7979, '0.0.0.0'); // Binding to 0.0.0.0 means remotes can connect $webServer = new IoServer( new HttpServer( new WsServer( new WampServer( $oChat ) ) ), $oWebSock ); $oLoop-&gt;run(); </code></pre> <p>After a message is being added to database : <strong>MessagesController.php</strong></p> <pre><code>.... // This is our new stuff $oContext = new \ZMQContext(); $oSocket = $oContext-&gt;getSocket(\ZMQ::SOCKET_PUSH, 'PushMe'); $oSocket-&gt;connect("tcp://mydomain:5555"); $aData = array( 'topic' =&gt; 'message', 'sUsername' =&gt; $oUserCurrent-&gt;getUsername(), 'sMessage' =&gt; $sMessage ); $oSocket-&gt;send(json_encode($aData)); ..... </code></pre> <p>The chat service : <strong>Chat.php</strong></p> <pre><code>/** * A lookup of all the topics clients have subscribed to */ public function onSubscribe(ConnectionInterface $conn, $topic) { // When a visitor subscribes to a topic link the Topic object in a lookup array $subject = $topic-&gt;getId(); $ip = $conn-&gt;remoteAddress; if (!array_key_exists($subject, $this-&gt;subscribedTopics)) { $this-&gt;subscribedTopics[$subject] = $topic; } $this-&gt;clients[] = $conn-&gt;resourceId; echo sprintf("New Connection: %s" . PHP_EOL, $conn-&gt;remoteAddress); } /** * @param string JSON'ified string we'll receive from ZeroMQ */ public function onMessage($jData) { $aData = json_decode($jData, true); var_dump($aData); if (!array_key_exists($aData['topic'], $this-&gt;subscribedTopics)) { return; } $topic = $this-&gt;subscribedTopics[$aData['topic']]; // This sends out everything to multiple users, not what I want!! // re-send the data to all the clients subscribed to that category $topic-&gt;broadcast($aData); } </code></pre> <p>JS code that receives data : <strong>messages.html.twig</strong> : </p> <pre><code>var conn = new ab.Session( 'ws://mydomain:7979' // The host (our Ratchet WebSocket server) to connect to , function() { // Once the connection has been established conn.subscribe('message', function(topic, data) { console.log(topic); console.log(data); }); } , function() { // When the connection is closed console.warn('WebSocket connection closed'); } , { // Additional parameters, we're ignoring the WAMP sub-protocol for older browsers 'skipSubprotocolCheck': true } ); </code></pre> <p>So everytings working perfectly, when I send a new Message, it goes to DB then it lands on the page of the chat.</p> <p><strong>PROBLEM :</strong> The data lands wherever the JS script is, and the result is that all users can get the same recorded message</p> <p><strong>ASKING :</strong> How can I make data lands in a <strong>specific user</strong> page ?</p> <p>Thank you</p> </div>

通过PHP向tornado websocket服务器发送消息?

<div class="post-text" itemprop="text"> <p>I'm running a tornado websocket server and I need to use php to send a message to it. Is this possible and if so, how do I do it? Everything I'm finding through search is about setting up a php websocket server, but I already have it set up in python...I just need to use php to communicate with it.</p> </div>

PHP WebSocket wss

<div class="post-text" itemprop="text"> <p>For a project I have to setup a web and websocket server. I do have an ssl certificate (self signed) but I can't (even after a lot of google and stackoverflow) get wss to work. Does anyone here have a good resource that explains some things about this? I tried with stunnel forwarding but that didn't workout for me. I forgot where I found the library but the websocket class name is ws api.php (with the space included)</p> </div>

websocket如何定时推送随机数到客户端?

用WebSocket,WebWorker和requestAnimationFrame如何实现服务端定时推送随机数到客户端?

从http通过websocket服务器访问的PHP发送数据

<div class="post-text" itemprop="text"> <p><strong>The problem:</strong> </p> <p>Ok, now the user send data through normal HTTP request to the server, PHP did the process needed and fetch the result from the database, now I want to send these data back to a user throughout WS instead of HTTP.</p> <p><strong>Used technology:</strong></p> <p>PHP &amp; Ratchet</p> <p>JS</p> <p><strong>Code:</strong></p> <p>Normal websocket ran by command</p> <pre><code>$server = IoServer::factory( new HttpServer( new WsServer( new Receiver() ) ), env('CHAT_PORT',8080) ); $server-&gt;run(); </code></pre> <p>and the receiver has a property called <code>$userAuthSocketMapper</code> which map between the Authentication key of the user (the http side) and the resourceId (the ws side).</p> <p><strong>What am thinking of:</strong></p> <p>If i only can get the <code>Receiver</code> instance which ran by Ratchet, I can easily access its resourceId property and its send method to send the data to the user i want. but how to get that instance when user send http request instead of ws request !</p> </div>

activemq与websocket结合无法向前台推送

activemq接收到消息后,调用websocket的convertAndSend接口向前台发送消息,前台接收不到。但是通过在controller里面编写测试代码,调用convertAndSend进行发送,前台是可以接收到信息的。请问是怎么回事呢。 activemq的接收端代码: @Service public class CalculateQueueReceiver implements MessageListener { @Autowired private MessageSendMaster messageSendMaster; @Override public void onMessage(Message message) { ActiveMQBytesMessage bytesMessage = (ActiveMQBytesMessage) message; String s = new String(bytesMessage.getContent().getData()); System.out.println(new Date() + s); messageSendMaster.sendMessage(s); } } @Component public class MessageSendMaster { private static Logger logger = Logger.getLogger(MessageSendMaster.class); @Autowired private SimpMessagingTemplate template; public void sendMessage(String message){ try { template.convertAndSend("/topic/calculate", message); } catch (Exception e) { logger.error(e.getMessage(), e); e.printStackTrace(); } } }

如何在web项目中在websocket关闭之前把服务器端的当前页面数据存储到mysql中??

对websocket不是很懂,希望能贴代码!!我是想做一个类似于qq及时通讯的功能,然后可以把聊天数据存到数据库里面,然后能够调出来查询并显示。但是翻阅了很多网站好像并没有详细的说明,在此先谢谢各位大佬了,勿喷!!

websocket client执行socket_write 就断开连接

php 充当websocket客户端,模拟向服务器端发消息,但是一执行socket_write连接就丢失了。 是因为php是短连接吗?我在服务端有监控发送的消息,没有收到消息。 代码: $socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); $result = socket_connect($socket, '********', ***); echo $result."\n"; echo "Send Command..........\n"; $msg = 'test msg'; socket_write($socket, $msg, strlen($msg)); echo "OK\n"; echo "Reading Backinformatin:\n\n"; while ($out = socket_read($socket, 2048)) { echo $out." out\n"; } echo "Close socket........\n"; //socket_close($socket); echo "OK,He He.\n\n";

用STM32控制ESP8266发送http请求把数据发送给自己的服务器,有大神能指导一下吗?

用STM32控制ESP8266连接路由器,并通过发送http请求把数据发送给自己的服务器,服务器端准备用PHP处理数据,有大神能指导一下吗?万分感谢!

使用html5 getusermedia创建webm文件并将其发送到服务器

<div class="post-text" itemprop="text"> <p>Can anyone give me some links to help me achieve this,</p> <p>I want to get the webcam video (getusermedia html5) , send that webm file(not recorded , live) to the server where it will be encoded and segmented to be broadcasted to others.</p> <p>I have no idea on how to create a live stream of webm video from the cam and send it to the server .. need not be websockets</p> </div>

websocket Could not decode a text frame as UTF-8

最近使用到了websocket来推送消息到浏览器端,当服务器端推送消息频繁的时候,浏览器很容易就报错了,提示failed: Could not decode a text frame as UTF-8,且看到浏览器获取到的服务端推送的消息内容为 (Opcode -1),频率的话是用15个线程推送消息就基本上只能成功3-4条,然后浏览器就报错了,请问这个错误到底提示的是什么意思呢,有什么办法可以解决,现在我使用thread.sleep(1000),强制推送一条之后间隔1s再推送,感觉很low的样子,求大神帮忙啊

将数据从php服务器发送到vb.net客户端

<div class="post-text" itemprop="text"> <p>I want to send data from online PHP website to a client program (vb.net, but can be another language) without request. I mean that I have a website where customers make something and receive these data on a desktop.</p> <blockquote> <pre><code> (no request) </code></pre> <p>PHP script from website -------------------------&gt; vb.net on a desktop</p> </blockquote> <p>Which is the best way for you? Can I use websockets or there are better and simple way to do this? Or I reads data from vb.net timing the task?</p> <p>ty</p> </div>

websocket 通讯 A server must not mask any frames that it sends to the client.

主要用C开发服务器端(websocket):握手,拆包都正常,但发送给浏览器的老是自动断开,一开始以为是粘包问题,结果最后用最简单是例子(只处理握手和发包,接的包不处理)也是如此, unsigned char frame[] = {0x81,0x01,0x68}; // h send(connfd, frame, strlen(frame),0); 这个数据帧够简单了吧?(握手,读取浏览器的帧正常) 但结果确实这样: A server must not mask any frames that it sends to the client. 但当我换成PHP时却一切正常,主要代码如下功能和上面的一样: $data = pack('H*', implode('',array('81', '01', '68'))); socket_send($conn, $data, strlen($data), 0); 使用sokit模拟客户端收到的包内容一模一样,如下: 12:45:07 DAT---> <3> ..h [81 01 68] 无语了。。。。,

有关PHP处理POST请求,如何向客户端返回数据

客户端ajax调用 服务器通过 POST 全局变量 获取POST参数处理了请求后,如何将结果返回给客户端 有说用websocket,请问怎么获得用户端的ip和端口呢?而且用户ip是局域网怎么办

软件测试入门、SQL、性能测试、测试管理工具

软件测试2小时入门,让您快速了解软件测试基本知识,有系统的了解; SQL一小时,让您快速理解和掌握SQL基本语法 jmeter性能测试 ,让您快速了解主流来源性能测试工具jmeter 测试管理工具-禅道,让您快速学会禅道的使用,学会测试项目、用例、缺陷的管理、

计算机组成原理实验教程

西北工业大学计算机组成原理实验课唐都仪器实验帮助,同实验指导书。分为运算器,存储器,控制器,模型计算机,输入输出系统5个章节

Java 最常见的 200+ 面试题:面试必备

这份面试清单是从我 2015 年做了 TeamLeader 之后开始收集的,一方面是给公司招聘用,另一方面是想用它来挖掘在 Java 技术栈中,还有那些知识点是我不知道的,我想找到这些技术盲点,然后修复它,以此来提高自己的技术水平。虽然我是从 2009 年就开始参加编程工作了,但我依旧觉得自己现在要学的东西很多,并且学习这些知识,让我很有成就感和满足感,那所以何乐而不为呢? 说回面试的事,这份面试...

winfrom中嵌套html,跟html的交互

winfrom中嵌套html,跟html的交互,源码就在里面一看就懂,很简单

玩转Python-Python3基础入门

总课时80+,提供源码和相关资料 本课程从Python零基础到纯Python项目实战。内容详细,案例丰富,覆盖了Python知识的方方面面,学完后不仅对Python知识有个系统化的了解,让你从Python小白变编程大牛! 课程包含: 1.python安装 2.变量、数据类型和运算符 3.选择结构 4.循环结构 5.函数和模块 6.文件读写 7.了解面向对象 8.异常处理

程序员的兼职技能课

获取讲师答疑方式: 在付费视频第一节(触摸命令_ALL)片头有二维码及加群流程介绍 限时福利 原价99元,今日仅需39元!购课添加小助手(微信号:itxy41)按提示还可领取价值800元的编程大礼包! 讲师介绍: 苏奕嘉&nbsp;前阿里UC项目工程师 脚本开发平台官方认证满级(六级)开发者。 我将如何教会你通过【定制脚本】赚到你人生的第一桶金? 零基础程序定制脚本开发课程,是完全针对零脚本开发经验的小白而设计,课程内容共分为3大阶段: ①前期将带你掌握Q开发语言和界面交互开发能力; ②中期通过实战来制作有具体需求的定制脚本; ③后期将解锁脚本的更高阶玩法,打通任督二脉; ④应用定制脚本合法赚取额外收入的完整经验分享,带你通过程序定制脚本开发这项副业,赚取到你的第一桶金!

HoloLens2开发入门教程

本课程为HoloLens2开发入门教程,讲解部署开发环境,安装VS2019,Unity版本,Windows SDK,创建Unity项目,讲解如何使用MRTK,编辑器模拟手势交互,打包VS工程并编译部署应用到HoloLens上等。

基于VHDL的16位ALU简易设计

基于VHDL的16位ALU简易设计,可完成基本的加减、带进位加减、或、与等运算。

MFC一站式终极全套课程包

该套餐共包含从C小白到C++到MFC的全部课程,整套学下来绝对成为一名C++大牛!!!

利用Verilog实现数字秒表(基本逻辑设计分频器练习)

设置复位开关。当按下复位开关时,秒表清零并做好计时准备。在任何情况下只要按下复位开关,秒表都要无条件地进行复位操作,即使是在计时过程中也要无条件地进行清零操作。 设置启/停开关。当按下启/停开关后,将

董付国老师Python全栈学习优惠套餐

购买套餐的朋友可以关注微信公众号“Python小屋”,上传付款截图,然后领取董老师任意图书1本。

Python可以这样学(第一季:Python内功修炼)

董付国系列教材《Python程序设计基础》、《Python程序设计(第2版)》、《Python可以这样学》配套视频,讲解Python 3.5.x和3.6.x语法、内置对象用法、选择与循环以及函数设计与使用、lambda表达式用法、字符串与正则表达式应用、面向对象编程、文本文件与二进制文件操作、目录操作与系统运维、异常处理结构。

计算机操作系统 第三版.pdf

计算机操作系统 第三版 本书全面介绍了计算机系统中的一个重要软件——操作系统(OS),本书是第三版,对2001年出版的修订版的各章内容均作了较多的修改,基本上能反映当前操作系统发展的现状,但章节名称基

技术大佬:我去,你写的 switch 语句也太老土了吧

昨天早上通过远程的方式 review 了两名新来同事的代码,大部分代码都写得很漂亮,严谨的同时注释也很到位,这令我非常满意。但当我看到他们当中有一个人写的 switch 语句时,还是忍不住破口大骂:“我擦,小王,你丫写的 switch 语句也太老土了吧!” 来看看小王写的代码吧,看完不要骂我装逼啊。 private static String createPlayer(PlayerTypes p...

Vue.js 2.0之全家桶系列视频课程

基于新的Vue.js 2.3版本, 目前新全的Vue.js教学视频,让你少走弯路,直达技术前沿! 1. 包含Vue.js全家桶(vue.js、vue-router、axios、vuex、vue-cli、webpack、ElementUI等) 2. 采用笔记+代码案例的形式讲解,通俗易懂

微信公众平台开发入门

本套课程的设计完全是为初学者量身打造,课程内容由浅入深,课程讲解通俗易懂,代码实现简洁清晰。通过本课程的学习,学员能够入门微信公众平台开发,能够胜任企业级的订阅号、服务号、企业号的应用开发工作。 通过本课程的学习,学员能够对微信公众平台有一个清晰的、系统性的认识。例如,公众号是什么,它有什么特点,它能做什么,怎么开发公众号。 其次,通过本课程的学习,学员能够掌握微信公众平台开发的方法、技术和应用实现。例如,开发者文档怎么看,开发环境怎么搭建,基本的消息交互如何实现,常用的方法技巧有哪些,真实应用怎么开发。

150讲轻松搞定Python网络爬虫

【为什么学爬虫?】 &nbsp; &nbsp; &nbsp; &nbsp;1、爬虫入手容易,但是深入较难,如何写出高效率的爬虫,如何写出灵活性高可扩展的爬虫都是一项技术活。另外在爬虫过程中,经常容易遇到被反爬虫,比如字体反爬、IP识别、验证码等,如何层层攻克难点拿到想要的数据,这门课程,你都能学到! &nbsp; &nbsp; &nbsp; &nbsp;2、如果是作为一个其他行业的开发者,比如app开发,web开发,学习爬虫能让你加强对技术的认知,能够开发出更加安全的软件和网站 【课程设计】 一个完整的爬虫程序,无论大小,总体来说可以分成三个步骤,分别是: 网络请求:模拟浏览器的行为从网上抓取数据。 数据解析:将请求下来的数据进行过滤,提取我们想要的数据。 数据存储:将提取到的数据存储到硬盘或者内存中。比如用mysql数据库或者redis等。 那么本课程也是按照这几个步骤循序渐进的进行讲解,带领学生完整的掌握每个步骤的技术。另外,因为爬虫的多样性,在爬取的过程中可能会发生被反爬、效率低下等。因此我们又增加了两个章节用来提高爬虫程序的灵活性,分别是: 爬虫进阶:包括IP代理,多线程爬虫,图形验证码识别、JS加密解密、动态网页爬虫、字体反爬识别等。 Scrapy和分布式爬虫:Scrapy框架、Scrapy-redis组件、分布式爬虫等。 通过爬虫进阶的知识点我们能应付大量的反爬网站,而Scrapy框架作为一个专业的爬虫框架,使用他可以快速提高我们编写爬虫程序的效率和速度。另外如果一台机器不能满足你的需求,我们可以用分布式爬虫让多台机器帮助你快速爬取数据。 &nbsp; 从基础爬虫到商业化应用爬虫,本套课程满足您的所有需求! 【课程服务】 专属付费社群+每周三讨论会+1v1答疑

SEIR课程设计源码与相关城市数据.rar

SEIR结合学报与之前博客结合所做的一些改进,选择其中三个城市进行拟合仿真SEIR结合学报与之前博客结合所做的一些改进,选择其中三个城市进行拟合仿真SEIR结合学报与之前博客结合所做的一些改进,选择其

Python数据挖掘简易入门

&nbsp; &nbsp; &nbsp; &nbsp; 本课程为Python数据挖掘方向的入门课程,课程主要以真实数据为基础,详细介绍数据挖掘入门的流程和使用Python实现pandas与numpy在数据挖掘方向的运用,并深入学习如何运用scikit-learn调用常用的数据挖掘算法解决数据挖掘问题,为进一步深入学习数据挖掘打下扎实的基础。

2019 AI开发者大会

2019 AI开发者大会(AI ProCon 2019)是由中国IT社区CSDN主办的AI技术与产业年度盛会。多年经验淬炼,如今蓄势待发:2019年9月6-7日,大会将有近百位中美顶尖AI专家、知名企业代表以及千余名AI开发者齐聚北京,进行技术解读和产业论证。我们不空谈口号,只谈技术,诚挚邀请AI业内人士一起共铸人工智能新篇章!

Java面试题大全(2020版)

发现网上很多Java面试题都没有答案,所以花了很长时间搜集整理出来了这套Java面试题大全,希望对大家有帮助哈~ 本套Java面试题大全,全的不能再全,哈哈~ 一、Java 基础 1. JDK 和 JRE 有什么区别? JDK:Java Development Kit 的简称,java 开发工具包,提供了 java 的开发环境和运行环境。 JRE:Java Runtime Environ...

定量遥感中文版 梁顺林著 范闻捷译

这是梁顺林的定量遥感的中文版,由范闻捷等翻译的,是电子版PDF,解决了大家看英文费时费事的问题,希望大家下载看看,一定会有帮助的

GIS程序设计教程 基于ArcGIS Engine的C#开发实例

张丰,杜震洪,刘仁义编著.GIS程序设计教程 基于ArcGIS Engine的C#开发实例.浙江大学出版社,2012.05

人工智能-计算机视觉实战之路(必备算法+深度学习+项目实战)

系列课程主要分为3大阶段:(1)首先掌握计算机视觉必备算法原理,结合Opencv进行学习与练手,通过实际视项目进行案例应用展示。(2)进军当下最火的深度学习进行视觉任务实战,掌握深度学习中必备算法原理与网络模型架构。(3)结合经典深度学习框架与实战项目进行实战,基于真实数据集展开业务分析与建模实战。整体风格通俗易懂,项目驱动学习与就业面试。 建议同学们按照下列顺序来进行学习:1.Python入门视频课程 2.Opencv计算机视觉实战(Python版) 3.深度学习框架-PyTorch实战/人工智能框架实战精讲:Keras项目 4.Python-深度学习-物体检测实战 5.后续实战课程按照自己喜好选择就可以

三个项目玩转深度学习(附1G源码)

从事大数据与人工智能开发与实践约十年,钱老师亲自见证了大数据行业的发展与人工智能的从冷到热。事实证明,计算机技术的发展,算力突破,海量数据,机器人技术等,开启了第四次工业革命的序章。深度学习图像分类一直是人工智能的经典任务,是智慧零售、安防、无人驾驶等机器视觉应用领域的核心技术之一,掌握图像分类技术是机器视觉学习的重中之重。针对现有线上学习的特点与实际需求,我们开发了人工智能案例实战系列课程。打造:以项目案例实践为驱动的课程学习方式,覆盖了智能零售,智慧交通等常见领域,通过基础学习、项目案例实践、社群答疑,三维立体的方式,打造最好的学习效果。

微信小程序开发实战之番茄时钟开发

微信小程序番茄时钟视频教程,本课程将带着各位学员开发一个小程序初级实战类项目,针对只看过官方文档而又无从下手的开发者来说,可以作为一个较好的练手项目,对于有小程序开发经验的开发者而言,可以更好加深对小程序各类组件和API 的理解,为更深层次高难度的项目做铺垫。

面试了一个 31 岁程序员,让我有所触动,30岁以上的程序员该何去何从?

最近面试了一个31岁8年经验的程序猿,让我有点感慨,大龄程序猿该何去何从。

去除异常值matlab程序

数据预处理中去除异常值的程序,matlab写成

用verilog HDL语言编写的秒表

在秒表设计中,分模块书写。用在七段数码管上显示。输入频率是1KHZ.可以显示百分秒,秒,分。如要显示小时,只需修改leds里的代码和主模块代码。改程序以通过硬件电路验证。完全正确。

[透视java——反编译、修补和逆向工程技术]源代码

源代码。

相关热词 c# 开发接口 c# 中方法上面的限制 c# java 时间戳 c#单元测试入门 c# 数组转化成文本 c#实体类主外键关系设置 c# 子函数 局部 c#窗口位置设置 c# list 查询 c# 事件 执行顺序
立即提问
相关内容推荐