Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/365.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 404连接到套接字的错误请求错误_Java_Android_Sockets_Http Status Code 400 - Fatal编程技术网

Java 404连接到套接字的错误请求错误

Java 404连接到套接字的错误请求错误,java,android,sockets,http-status-code-400,Java,Android,Sockets,Http Status Code 400,我想连接到一个需要登录的套接字,然后再将连接和登录参数作为查询参数发送 为了连接插座,我正在使用此库- 这是为他们的演示插座工作,但我无法连接到我的插座 JavaScript中的web代码如下所示 socket : io.connect('52.11.67.123:6060', { query: {user:JSON.stringify({user:usercus}) ,login:JSON.stringify({username:'esw',password:'escrust'})}}),

我想连接到一个需要登录的套接字,然后再将连接和登录参数作为查询参数发送

为了连接插座,我正在使用此库-

这是为他们的演示插座工作,但我无法连接到我的插座

JavaScript中的web代码如下所示

socket : io.connect('52.11.67.123:6060', { query: {user:JSON.stringify({user:usercus}) ,login:JSON.stringify({username:'esw',password:'escrust'})}}),
某些库用于连接套接字并发送查询参数

在android中,为了发送查询参数,我尝试使用Uri.Builder,将url与客户端url进行匹配,但仍然无法与之连接

代码:

客户端url如下所示:

 ws://52.11.67.123:6060/socket.io/?user=%7B%22user%22%3A%7B%22customer_id%22%3A%2210%22%2C%22customer_group_id%22%3A%220%22%2C%22password%22%3A%2281dc9bdb52d04dc20036dbd8313ed055%22%2C%22first_name%22%3A%22iykeone%22%2C%22last_name%22%3A%22Idukpaye%22%2C%22email%22%3A%22iykeidukpaye%40gmail.com%22%2C%22address%22%3A%2230%22%2C%22is_company%22%3A%221%22%2C%22photo%22%3A%22upload%2F1504896445753.png%22%2C%22business_type%22%3A%22test%22%2C%22ip%22%3A%22%22%2C%22customer_unique_id%22%3A%22271113lq034225%22%2C%22status%22%3A%220%22%2C%22date_added%22%3A%222013-11-27%2003%3A42%3A25%22%2C%22date_login%22%3A%222016-10-04%2009%3A22%3A47%22%2C%22online_status%22%3A%220%22%2C%22is_forget_password%22%3A%220%22%2C%22customer_add%22%3A%22%22%2C%22phonecode%22%3A%220%22%2C%22phonecode1%22%3A%220%22%2C%22phonecode2%22%3A%220%22%2C%22customer_phone%22%3A%220%22%2C%22business_info%22%3A%22%22%2C%22bank_ac%22%3A%22012102102%22%2C%22bank_name%22%3A%22bfbdbfsb%22%2C%22routing_no%22%3A%227895464%22%2C%22bank_address%22%3A%22iykeidukpaye%40yahoo.com%22%2C%22bank_country%22%3A%228%22%2C%22bank_ac_type%22%3A%22current%22%2C%22bank_ac_name%22%3A%22IykeIdukpaye%22%2C%22bank_ac_address1%22%3A%22Test%20Test%20%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Teest%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%22%2C%22bank_ac_address2%22%3A%22Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%22%2C%22dr_cr_card%22%3A%22Mc%22%2C%22purpose_code%22%3A%22CONSULTING%22%2C%22confirmation_code%22%3A%22%22%2C%22dispatcher%22%3A%221%22%2C%22dispatch_plan%22%3A%225%22%2C%22dispatcher_id%22%3A%22TDP10LDI%22%2C%22dispatcher_location%22%3A%22%5B%5C%22Local%5C%22%2C%5C%22Domestic%5C%22%2C%5C%22International%5C%22%5D%22%2C%22merchant%22%3A%225%22%2C%22verify%22%3A%220%22%2C%22customer_phone1%22%3A%220%22%2C%22customer_phone2%22%3A%220%22%2C%22verify1%22%3A%220%22%2C%22verify2%22%3A%220%22%2C%22dispatch_status%22%3A%220%22%2C%22dispatch_limit%22%3A%2234800%22%2C%22Ratings%22%3A%220%22%2C%22deviceNotificationToken%22%3Anull%2C%22bankname%22%3A%22ANTARCTICA%22%7D%7D&login=%7B%22username%22%3A%22escw%22%2C%22password%22%3A%22escrndtrust%22%7D&EIO=3&transport=websocket&sid=voy5xrGfTWNs6nSFAAAr
ws://52.11.67.123:6060/socket.io/?user=%7B%22user%22%3A%7B%22customer_group_id%22%3A%220%22%2C%22customer_unique_id%22%3A%22271113lq034225%22%2C%22bank_name%22%3A%22bfbdbfsb%22%2C%22dispatch_plan%22%3A%225%22%2C%22verify2%22%3A%220%22%2C%22verify%22%3A%220%22%2C%22verify1%22%3A%220%22%2C%22customer_phone%22%3A%220%22%2C%22date_login%22%3A%222016-10-04%2009%3A22%3A47%22%2C%22password%22%3A%2281dc9bdb52d04dc20036dbd8313ed055%22%2C%22dispatcher%22%3A%221%22%2C%22bank_ac_type%22%3A%22current%22%2C%22dr_cr_card%22%3A%22Mc%22%2C%22routing_no%22%3A%227895464%22%2C%22is_forget_password%22%3A%220%22%2C%22first_name%22%3A%22iykeone%22%2C%22purpose_code%22%3A%22CONSULTING%22%2C%22bank_ac_address1%22%3A%22Test%20Test%20%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Teest%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%22%2C%22date_added%22%3A%222013-11-27%2003%3A42%3A25%22%2C%22phonecode%22%3A%220%22%2C%22dispatcher_location%22%3A%22%5B%5C%22Local%5C%22%2C%5C%22Domestic%5C%22%2C%5C%22International%5C%22%5D%22%2C%22bank_ac_address2%22%3A%22Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%22%2C%22bank_country%22%3A%228%22%2C%22bank_address%22%3A%22iykeidukpaye%40yahoo.com%22%2C%22phonecode2%22%3A%220%22%2C%22phonecode1%22%3A%220%22%2C%22customer_add%22%3A%22%22%2C%22online_status%22%3A%220%22%2C%22customer_phone1%22%3A%220%22%2C%22customer_phone2%22%3A%220%22%2C%22bankname%22%3A%22ANTARCTICA%22%2C%22merchant%22%3A%225%22%2C%22bank_ac%22%3A%22012102102%22%2C%22status%22%3A%220%22%2C%22Ratings%22%3A%220%22%2C%22confirmation_code%22%3A%22%22%2C%22business_info%22%3A%22%22%2C%22dispatcher_id%22%3A%22TDP10LDI%22%2C%22dispatch_status%22%3A%220%22%2C%22bank_ac_name%22%3A%22IykeIdukpaye%22%2C%22photo%22%3A%22upload%5C%2F1504896445753.png%22%2C%22ip%22%3A%22%22%2C%22address%22%3A%2230%22%2C%22email%22%3A%22iykeidukpaye%40gmail.com%22%2C%22is_company%22%3A%221%22%2C%22last_name%22%3A%22Idukpaye%22%2C%22dispatch_limit%22%3A%2234800%22%2C%22business_type%22%3A%22test%22%2C%22customer_id%22%3A%2210%22%7D%7D&login=%7B%22username%22%20%3A%20%22esw%22%2C%22password%22%20%3A%20%22esrowtrust%22%7D&EIO=3&transport=websocket&sid=voy5xrGfTWNs6nSFAAAr
我的url如下所示:

 ws://52.11.67.123:6060/socket.io/?user=%7B%22user%22%3A%7B%22customer_id%22%3A%2210%22%2C%22customer_group_id%22%3A%220%22%2C%22password%22%3A%2281dc9bdb52d04dc20036dbd8313ed055%22%2C%22first_name%22%3A%22iykeone%22%2C%22last_name%22%3A%22Idukpaye%22%2C%22email%22%3A%22iykeidukpaye%40gmail.com%22%2C%22address%22%3A%2230%22%2C%22is_company%22%3A%221%22%2C%22photo%22%3A%22upload%2F1504896445753.png%22%2C%22business_type%22%3A%22test%22%2C%22ip%22%3A%22%22%2C%22customer_unique_id%22%3A%22271113lq034225%22%2C%22status%22%3A%220%22%2C%22date_added%22%3A%222013-11-27%2003%3A42%3A25%22%2C%22date_login%22%3A%222016-10-04%2009%3A22%3A47%22%2C%22online_status%22%3A%220%22%2C%22is_forget_password%22%3A%220%22%2C%22customer_add%22%3A%22%22%2C%22phonecode%22%3A%220%22%2C%22phonecode1%22%3A%220%22%2C%22phonecode2%22%3A%220%22%2C%22customer_phone%22%3A%220%22%2C%22business_info%22%3A%22%22%2C%22bank_ac%22%3A%22012102102%22%2C%22bank_name%22%3A%22bfbdbfsb%22%2C%22routing_no%22%3A%227895464%22%2C%22bank_address%22%3A%22iykeidukpaye%40yahoo.com%22%2C%22bank_country%22%3A%228%22%2C%22bank_ac_type%22%3A%22current%22%2C%22bank_ac_name%22%3A%22IykeIdukpaye%22%2C%22bank_ac_address1%22%3A%22Test%20Test%20%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Teest%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%22%2C%22bank_ac_address2%22%3A%22Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%22%2C%22dr_cr_card%22%3A%22Mc%22%2C%22purpose_code%22%3A%22CONSULTING%22%2C%22confirmation_code%22%3A%22%22%2C%22dispatcher%22%3A%221%22%2C%22dispatch_plan%22%3A%225%22%2C%22dispatcher_id%22%3A%22TDP10LDI%22%2C%22dispatcher_location%22%3A%22%5B%5C%22Local%5C%22%2C%5C%22Domestic%5C%22%2C%5C%22International%5C%22%5D%22%2C%22merchant%22%3A%225%22%2C%22verify%22%3A%220%22%2C%22customer_phone1%22%3A%220%22%2C%22customer_phone2%22%3A%220%22%2C%22verify1%22%3A%220%22%2C%22verify2%22%3A%220%22%2C%22dispatch_status%22%3A%220%22%2C%22dispatch_limit%22%3A%2234800%22%2C%22Ratings%22%3A%220%22%2C%22deviceNotificationToken%22%3Anull%2C%22bankname%22%3A%22ANTARCTICA%22%7D%7D&login=%7B%22username%22%3A%22escw%22%2C%22password%22%3A%22escrndtrust%22%7D&EIO=3&transport=websocket&sid=voy5xrGfTWNs6nSFAAAr
ws://52.11.67.123:6060/socket.io/?user=%7B%22user%22%3A%7B%22customer_group_id%22%3A%220%22%2C%22customer_unique_id%22%3A%22271113lq034225%22%2C%22bank_name%22%3A%22bfbdbfsb%22%2C%22dispatch_plan%22%3A%225%22%2C%22verify2%22%3A%220%22%2C%22verify%22%3A%220%22%2C%22verify1%22%3A%220%22%2C%22customer_phone%22%3A%220%22%2C%22date_login%22%3A%222016-10-04%2009%3A22%3A47%22%2C%22password%22%3A%2281dc9bdb52d04dc20036dbd8313ed055%22%2C%22dispatcher%22%3A%221%22%2C%22bank_ac_type%22%3A%22current%22%2C%22dr_cr_card%22%3A%22Mc%22%2C%22routing_no%22%3A%227895464%22%2C%22is_forget_password%22%3A%220%22%2C%22first_name%22%3A%22iykeone%22%2C%22purpose_code%22%3A%22CONSULTING%22%2C%22bank_ac_address1%22%3A%22Test%20Test%20%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Teest%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%22%2C%22date_added%22%3A%222013-11-27%2003%3A42%3A25%22%2C%22phonecode%22%3A%220%22%2C%22dispatcher_location%22%3A%22%5B%5C%22Local%5C%22%2C%5C%22Domestic%5C%22%2C%5C%22International%5C%22%5D%22%2C%22bank_ac_address2%22%3A%22Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%20Test%22%2C%22bank_country%22%3A%228%22%2C%22bank_address%22%3A%22iykeidukpaye%40yahoo.com%22%2C%22phonecode2%22%3A%220%22%2C%22phonecode1%22%3A%220%22%2C%22customer_add%22%3A%22%22%2C%22online_status%22%3A%220%22%2C%22customer_phone1%22%3A%220%22%2C%22customer_phone2%22%3A%220%22%2C%22bankname%22%3A%22ANTARCTICA%22%2C%22merchant%22%3A%225%22%2C%22bank_ac%22%3A%22012102102%22%2C%22status%22%3A%220%22%2C%22Ratings%22%3A%220%22%2C%22confirmation_code%22%3A%22%22%2C%22business_info%22%3A%22%22%2C%22dispatcher_id%22%3A%22TDP10LDI%22%2C%22dispatch_status%22%3A%220%22%2C%22bank_ac_name%22%3A%22IykeIdukpaye%22%2C%22photo%22%3A%22upload%5C%2F1504896445753.png%22%2C%22ip%22%3A%22%22%2C%22address%22%3A%2230%22%2C%22email%22%3A%22iykeidukpaye%40gmail.com%22%2C%22is_company%22%3A%221%22%2C%22last_name%22%3A%22Idukpaye%22%2C%22dispatch_limit%22%3A%2234800%22%2C%22business_type%22%3A%22test%22%2C%22customer_id%22%3A%2210%22%7D%7D&login=%7B%22username%22%20%3A%20%22esw%22%2C%22password%22%20%3A%20%22esrowtrust%22%7D&EIO=3&transport=websocket&sid=voy5xrGfTWNs6nSFAAAr
我不明白为什么它没有连接。 错误是:

错误:应为HTTP 101响应,但为“400错误请求”

我应该如何使用查询参数连接到套接字?
请帮忙。谢谢

您对url做了哪些更改?我添加了socket.io/和查询参数以及EIO、transport、sid,它们与客户端url一样硬编码,以检查是否可以连接到套接字@jwilsMaybe可以尝试一次只对url进行一个小的更改(一次安装所有url),尝试找出这些更改中是否有一个导致了问题。我尝试了每一个更改,只提供了登录对象,不提供socket.io,提供了所有参数,如果我丢失了这些参数中的任何一个,我会得到错误:连接{52.11.67.123:6060上的意外流结束,proxy=DIRECT@hostAddress=/52.11.67.123:6060 cipherSuite=none protocol=http/1.1},但提供了之后我也无法连接。你能帮我一下吗?我累坏了。你对url做了什么更改?我添加了socket.io/和查询参数,还有EIO、transport、sid,它们与客户端url一样硬编码,以检查我是否可以连接到套接字@jwilsMaybe可以尝试一次只对url进行一个小的更改(一次安装所有url),尝试找出这些更改中是否有一个导致了问题。我尝试了每一个更改,只提供了登录对象,不提供socket.io,提供了所有参数,如果我丢失了这些参数中的任何一个,我会得到错误:连接{52.11.67.123:6060上的意外流结束,proxy=DIRECT@hostAddress=/52.11.67.123:6060 cipherSuite=none protocol=http/1.1},但提供了之后我也无法连接。你能帮个忙吗?我累坏了。