Socket發(fā)送接收數(shù)據(jù)實例
Jun 08, 2016 pm 05:32 PM網(wǎng)上經(jīng)常有關于Socket的問題~教程~可是都非常官方,其實代碼我們都知道(F1幫助文檔里就有),只是由于沒有可測試用的Socket服務器..一直不能做測試跟進一步的研究。
今天打開已經(jīng)很久沒用的《易語言》,了一個簡單的socket服務器..其實我不知道算不算是socket服務器,只是監(jiān)聽端口,接收來自客戶端的數(shù)據(jù),發(fā)送數(shù)據(jù)到客戶端等等。不過在flash的socket例程下連接并發(fā)送接收成功,所以應該也算是吧..(ps:易語言,一個中文的編程軟件,別笑我,hehe,我不是理科出身的,沒什么文化,不過我覺得這個軟件對于像我這種只是需要輔助學習flash的前提前下,已經(jīng)足夠了,在這里也當作給易語言做個廣告,怎么說也是國人開發(fā)的東西)
這個小東東很簡單,啟動的時候自動監(jiān)聽8080端口,當flash連接上的時候就會顯示客戶端的ip,當flash發(fā)送數(shù)據(jù)到服務器的時候,就會把接收到的數(shù)據(jù)廣播給所有的客戶端(可以做簡單的聊天室)
這邊隨便上傳一個Flash的實例..只由Flash的例程修改來的..運行以后會直接連接本機的8080端口,連接成功后給服務器發(fā)送一條文本..然后服務器會返回該文本..在"輸出"窗口可以看到。

Hot AI Tools

Undress AI Tool
Undress images for free

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

This article brings you relevant knowledge about php+socket, which mainly introduces IO multiplexing and how php+socket implements web server? Friends who are interested can take a look below. I hope it will be helpful to everyone.

The first step on the SpringBoot side is to introduce dependencies. First we need to introduce the dependencies required for WebSocket, as well as the dependencies for processing the output format com.alibabafastjson1.2.73org.springframework.bootspring-boot-starter-websocket. The second step is to create the WebSocket configuration class importorg. springframework.context.annotation.Bean;importorg.springframework.context.annotation.Config

1. Socket programming based on TCP protocol 1. The socket workflow starts with the server side. The server first initializes the Socket, then binds to the port, listens to the port, calls accept to block, and waits for the client to connect. At this time, if a client initializes a Socket and then connects to the server (connect), if the connection is successful, the connection between the client and the server is established. The client sends a data request, the server receives the request and processes the request, then sends the response data to the client, the client reads the data, and finally closes the connection. An interaction ends. Use the following Python code to implement it: importso

PHP is a commonly used development language that can be used to develop various web applications. In addition to common HTTP requests and responses, PHP also supports network communication through Sockets to achieve more flexible and efficient data interaction. This article will introduce the methods and techniques of how to implement Socket communication in PHP, and attach specific code examples. What is Socket Communication Socket is a method of communication in a network that can transfer data between different computers. by S

Solution to the problem that the php socket cannot be connected: 1. Check whether the socket extension is enabled in php; 2. Open the php.ini file and check whether "php_sockets.dll" is loaded; 3. Uncomment "php_sockets.dll".

Flash is a software used to create multimedia and interactive content, with features such as vector graphics, timeline animation, interactivity, and multimedia processing capabilities. Although once very popular, Flash was gradually phased out with the rise of new technologies, and official support ceased in 2020.

Common network communication and security problems and solutions in C# In today's Internet era, network communication has become an indispensable part of software development. In C#, we usually encounter some network communication problems, such as data transmission security, network connection stability, etc. This article will discuss in detail common network communication and security issues in C# and provide corresponding solutions and code examples. 1. Network communication problems Network connection interruption: During the network communication process, the network connection may be interrupted, which may cause

This article brings you relevant knowledge about php+socket. It mainly introduces what is socket? How does php+socket realize client-server data transmission? Friends who are interested can take a look below. I hope it will be helpful to everyone.
