Socket发送普通消息到接口

版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/s1242413556/article/details/41115369

package socket;

import java.net.*;
import java.io.*;

public class MyConnection2
{  
    public static void main(String[] args) throws Exception
    {
        Socket socket = new Socket("111.111.111.111", 8888);
        // 向服务端程序发送数据
        PrintWriter bw = new PrintWriter(socket.getOutputStream());
        bw.write("sb");
        bw.flush();
       
        // 从服务端程序接收数据
        InputStream ips = socket.getInputStream();
        InputStreamReader ipsr = new InputStreamReader(ips);
        BufferedReader br = new BufferedReader(ipsr);
        String s = "";       
        while((s = br.readLine()) != null)
            System.out.println(s);       
        socket.close();
    }
}

展开阅读全文

微信第三方发布:[返回Api文本消息],[返回普通文本消息],[发送事件消息] 正确回复

12-01

[img=https://img-bbs.csdn.net/upload/201612/01/1480554218_605328.png][/img]rnrn全网发布,消息回复:按以下回复消息,并且要加密返回给微信服务。rn[size=16px] [b] [color=#FF0000] 成功![/color][/b][/size][img=https://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/9.gif][/img]rnrn接收到微信发来的解密后:MsgType -> text Content --> QUERY_AUTH_CODE:rn[code=text]rngh_3c884a361561rnozy4qt0Rsc9YJzR5nEeVAaTHg9DQrn1480553835rntextrnQUERY_AUTH_CODE:queryauthcode@@@GM-pziL3wZz1Uh6jP0AL_PMwGmOehioLgg4vxGOHkaHyywttVm5gq2k8UsOv9S3TiQ7tRpWGNDF-6HEgn4-xyQrn6358930301698764416rn rn[/code]rn我服务回复的:rn[code=text]rnrnozy4qt0Rsc9YJzR5nEeVAaTHg9DQrngh_3c884a361561rn1480582636rntextrnqueryauthcode@@@GM-pziL3wZz1Uh6jP0AL_PMwGmOehioLgg4vxGOHkaHyywttVm5gq2k8UsOv9S3TiQ7tRpWGNDF-6HEgn4-xyQ_from_apirnrn[/code]rnrnrnrnrnrn接收到微信发来的解密后:MsgType -> text Content -> TESTCOMPONENT_MSG_TYPE_TEXTrn[code=text]rngh_3c884a361561rnozy4qt0Rsc9YJzR5nEeVAaTHg9DQrn1480553844rntextrnTESTCOMPONENT_MSG_TYPE_TEXTrn6358930340353470082rnrn[/code]rn我服务回复的rn[code=text]rnrnozy4qt0Rsc9YJzR5nEeVAaTHg9DQrngh_3c884a361561rn1480582645rntextrnTESTCOMPONENT_MSG_TYPE_TEXT_callbackrnrn[/code]rnrnrnrn接收到微信发来的解密后:MsgType -> event Event -> LOCATION rn[code=text]rngh_3c884a361561rnozy4qt0Rsc9YJzR5nEeVAaTHg9DQrn1480553852rneventrnLOCATIONrn111.000000rn222.000000rn333.000000rnrn[/code]rnrn我服务回复的:rn[code=text]rnrnozy4qt0Rsc9YJzR5nEeVAaTHg9DQrngh_3c884a361561rn1480582653rntextrnLOCATIONfrom_callbackrnrn[/code]rnrn[b][size=18px]rn以上是我回复的基本情况,已经测试通过了!rn[/size][/b]rnrn欢迎大家加我微信 Jim2022 或 扫码加我,让我们一起进步吧!!!rn[img=https://img-bbs.csdn.net/upload/201612/01/1480558230_195315.png][/img]rnrnrn 论坛

没有更多推荐了,返回首页