asyncsocket

Receiving data from UDP server on iOS app is not working from Linux server, but works from macbook pro [closed]

浪子不回头ぞ 提交于 2019-12-23 17:27:48
问题 This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. Closed 6 years ago . BACKGROUND: I made an IPhone socket application based on UDP. It works as a client and server while it communicates with a Linux [Ubuntu] server. I’m

Send a message back to a list of clients at any given time with async sockets in C#

守給你的承諾、 提交于 2019-12-23 13:15:13
问题 Ive got an async server set up, it works perfectly by connecting, receiving and sending back a message to the connecting client. The server itself is a Game-World-Server (mmorpg style). When a user sends its position to where its located, I need to push this out to all the clients with a PlayerPositionNotice. I know I'm missing some basic stuff here, but when i try to save the StateObject that was created in the accept method, and use that socket to send back information to the player at any

Called From Wrong Thread Exception with AsyncTask

只愿长相守 提交于 2019-12-23 04:06:10
问题 I keep getting a CalledFromWrongThreadException even if i throw it into AsyncTask's DoInBackground method! Can anyone tell me why and how to fix it? /** * Recognizes key words in responseTexts and runs the appropriate function * @param responseText */ private void responseHandler(String responseText) { if(responseText.startsWith("Notes", 0)) { notes.add(responseText); new DownloadFilesTask().execute("WriteInternal" , null, null); } } this is my AsyncTask class private class DownloadFilesTask

In AsyncSocket framework, how to do more than one Socket Connection in iPhone?

允我心安 提交于 2019-12-23 03:57:14
问题 I am now using AsyncSocket for iPhone socketing connection development. http://code.google.com/p/cocoaasyncsocket/ But I am having problem that, how to connect 2 multi-server to collect data from server? I have host IP address A: 201.22.33.XXX.XX and host IP address B: 202.33.XXX.XX I can success connect one server to collect data. But how to collect both server at the same time? I tried create two socket objects with their own delegates, my path is like that: step 1 ---- Connect to A step 2

Null result on Converting NSData to NSString

自作多情 提交于 2019-12-22 10:35:36
问题 I am facing a problem when converting NSData to NSString . I'm using UTF8Enconding but the result is null !! Here is the data I receive <100226ab c0a8010b 00000000 00000000> it must be either 192.168.1.11 or 192.168.1.17 . This is the method I use to convert : NSString *ipAddress = [[NSString alloc] initWithData:address encoding:NSUTF8StringEncoding]; Is there anything wrong?! By the way, This the did receive data delegate of GCDAsyncUdpSocket library. 回答1: From the documentation of

why is time rising for more than one request to asyncio server in python?

大城市里の小女人 提交于 2019-12-20 00:44:45
问题 I wrote a pythonic server with socket. that should receives requests at the same time(parallel) and respond them parallel. When i send more than one request to it, the time of answering increase more than i expected. server: import datetime import asyncio, timeit import json, traceback from asyncio import get_event_loop requestslist = [] loop = asyncio.get_event_loop() async def handleData(reader, writer): message = '' clientip = '' data = bytearray() print("Async HandleData", datetime

why is time rising for more than one request to asyncio server in python?

主宰稳场 提交于 2019-12-20 00:44:25
问题 I wrote a pythonic server with socket. that should receives requests at the same time(parallel) and respond them parallel. When i send more than one request to it, the time of answering increase more than i expected. server: import datetime import asyncio, timeit import json, traceback from asyncio import get_event_loop requestslist = [] loop = asyncio.get_event_loop() async def handleData(reader, writer): message = '' clientip = '' data = bytearray() print("Async HandleData", datetime

iOS SDK: How can I check if a port is open?

巧了我就是萌 提交于 2019-12-20 00:43:46
问题 I have not found anything yet on how to check if a port is open or not. I tried to realize it with the AsyncSocket class but it returns always TRUE although I reject all connections to that port on my server. Additionally, I tried to use the isConnected method of AsyncSocket but that always returns FALSE. My code so far: //Init socket socket=[[AsyncSocket alloc] initWithDelegate:self]; //results on TRUE always! NSLog(@"Ready"); NSError *err = nil; if(![socket connectToHost:@"10.1.2.40" onPort

iOS SDK: How can I check if a port is open?

≯℡__Kan透↙ 提交于 2019-12-20 00:42:13
问题 I have not found anything yet on how to check if a port is open or not. I tried to realize it with the AsyncSocket class but it returns always TRUE although I reject all connections to that port on my server. Additionally, I tried to use the isConnected method of AsyncSocket but that always returns FALSE. My code so far: //Init socket socket=[[AsyncSocket alloc] initWithDelegate:self]; //results on TRUE always! NSLog(@"Ready"); NSError *err = nil; if(![socket connectToHost:@"10.1.2.40" onPort

ios开发 Socket通信

时光怂恿深爱的人放手 提交于 2019-12-18 13:20:21
ios开发 Socket通信 Socket描述了一个IP、端口对。它简化了程序员的操作,知道对方的IP以及PORT就可以给对方发送消息,再由服务器端来处理发送的这些消息。所以,Socket一定包含了通信的双发,即客户端(Client)与服务端(server)。 1)服务端利用Socket监听端口; 2)客户端发起连接; 3)服务端返回信息,建立连接,开始通信; 4)客户端,服务端断开连接。 1套接字(socket)概念 套接字(socket)是通信的基石,是支持TCP/IP协议的网络通信的基本操作单元。 应用层通过传输层进行数据通信时,TCP会遇到同时为多个应用程序进程提供并发服务的问题。多个TCP连接或多个应用程序进程可能需要通过同一个 TCP协议端口传输数据。为了 区别不同的应用程序进程和连接 ,许多计算机操作系统为应用程序与TCP/IP协议交互提供了套接字(Socket)接口。应 用层可以和传输层通过Socket接口,区分来自不同应用程序进程或网络连接的通信,实现数据传输的并发服务。 2 建立socket连接 建立Socket连接至少需要一对套接字,其中一个运行于客户端,称为ClientSocket,另一个运行于服务器端,称为ServerSocket。 套接字之间的连接过程分为三个步骤:服务器监听,客户端请求,连接确认。 服务器监听:服务器端套接字并不定位具体的客户端套接字