Search Results

Search found 5206 results on 209 pages for 'dr rocket mr socket'.

Page 16/209 | < Previous Page | 12 13 14 15 16 17 18 19 20 21 22 23  | Next Page >

  • Strange numbers in java socket output

    - by user293163
    I have small test app: Socket socket = new Socket("jeck.ru", 80); PrintWriter pw = new PrintWriter(socket.getOutputStream(), false); pw.println("GET /ip/ HTTP/1.1"); pw.println("Host: jeck.ru"); pw.println(); pw.flush(); BufferedReader rd = new BufferedReader(new InputStreamReader(socket.getInputStream())); String str; while ((str = rd.readLine()) != null) { System.out.println(str); } It`s output: HTTP/1.1 200 OK Date: Sat, 13 Mar 2010 22:06:51 GMT Content-Type: text/html;charset=utf-8 Transfer-Encoding: chunked Connection: keep-alive Keep-Alive: timeout=5 Server HTTP/1.1 200 OK Date: Sat, 13 Mar 2010 22:06:51 GMT Content-Type: text/html;charset=utf-8 Transfer-Encoding: chunked Connection: keep-alive Keep-Alive: timeout=5 Server: Apache Cache-Control: max-age=0 Expires: Sat, 13 Mar 2010 22:06:51 GMT 123 <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>??? IP</title> </head> <body> <div style='text-align: center; font: 32pt Verdana;margin-top: 300px'> ??? IP &#151; 94.103.87.153 </div> </body> </html> 0 Whence these numbers (123 an 0) takes?

    Read the article

  • Fragment method and socket.io

    - by Tolgay Toklar
    I have a method,this method updates an array list in fragment.I can call this method in main activity like this public void getFromUser(String message) { addMessageToFragment("ok"); } public void addMessageToFragment(String message) { Log.w("Step 1",message); frgObj.addMessageToList("asd"); } getFromUser is calling from fragment(when user presses the button) this is working as well.But I am using socket.io in my app,when I try to call this method from socket.io,app is not working. public void on(String event, IOAcknowledge ack, Object... args) { try{ addMessageToFragment("ok"); } catch (JSONException e) {} } When this callback function calls,app is giving this errors: 08-19 11:57:24.813: W/System.err(4962): io.socket.SocketIOException: Exception was thrown in on(String, JSONObject[]). 08-19 11:57:24.813: W/System.err(4962): Message was: 5:::{"name":"listele","args":[{"mesaj":"123","gonderen":"781722165-tolgay007-DKSMIcIYGahPuKXriM83","alici":"tolgay007","blck_id":"781722165-tolgay007","out_username":"Anony-781722","ars_status":1,"longinf":"3aqghef","a_status":1}]} 08-19 11:57:24.813: W/System.err(4962): at io.socket.IOConnection.transportMessage(IOConnection.java:702) 08-19 11:57:24.813: W/System.err(4962): at io.socket.WebsocketTransport.onMessage(WebsocketTransport.java:82) 08-19 11:57:24.813: W/System.err(4962): at org.java_websocket.client.WebSocketClient.onWebsocketMessage(WebSocketClient.java:361) 08-19 11:57:24.813: W/System.err(4962): at org.java_websocket.WebSocketImpl.deliverMessage(WebSocketImpl.java:565) 08-19 11:57:24.813: W/System.err(4962): at org.java_websocket.WebSocketImpl.decodeFrames(WebSocketImpl.java:331) 08-19 11:57:24.813: W/System.err(4962): at org.java_websocket.WebSocketImpl.decode(WebSocketImpl.java:152) 08-19 11:57:24.813: W/System.err(4962): at org.java_websocket.client.WebSocketClient.interruptableRun(WebSocketClient.java:247) 08-19 11:57:24.823: W/System.err(4962): at org.java_websocket.client.WebSocketClient.run(WebSocketClient.java:193) 08-19 11:57:24.823: W/System.err(4962): at java.lang.Thread.run(Thread.java:841) 08-19 11:57:24.823: W/System.err(4962): Caused by: android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views. 08-19 11:57:24.823: W/System.err(4962): at android.view.ViewRootImpl.checkThread(ViewRootImpl.java:6094) 08-19 11:57:24.823: W/System.err(4962): at android.view.ViewRootImpl.focusableViewAvailable(ViewRootImpl.java:2800) 08-19 11:57:24.823: W/System.err(4962): at android.view.ViewGroup.focusableViewAvailable(ViewGroup.java:650) 08-19 11:57:24.823: W/System.err(4962): at android.view.ViewGroup.focusableViewAvailable(ViewGroup.java:650) 08-19 11:57:24.823: W/System.err(4962): at android.view.ViewGroup.focusableViewAvailable(ViewGroup.java:650) 08-19 11:57:24.823: W/System.err(4962): at android.view.ViewGroup.focusableViewAvailable(ViewGroup.java:650) 08-19 11:57:24.823: W/System.err(4962): at android.view.ViewGroup.focusableViewAvailable(ViewGroup.java:650) 08-19 11:57:24.823: W/System.err(4962): at android.view.ViewGroup.focusableViewAvailable(ViewGroup.java:650) 08-19 11:57:24.823: W/System.err(4962): at android.view.ViewGroup.focusableViewAvailable(ViewGroup.java:650) 08-19 11:57:24.823: W/System.err(4962): at android.view.View.setFlags(View.java:8878) 08-19 11:57:24.823: W/System.err(4962): at android.view.View.setFocusableInTouchMode(View.java:6114) 08-19 11:57:24.823: W/System.err(4962): at android.widget.AdapterView.checkFocus(AdapterView.java:718) 08-19 11:57:24.823: W/System.err(4962): at android.widget.AdapterView$AdapterDataSetObserver.onChanged(AdapterView.java:813) 08-19 11:57:24.823: W/System.err(4962): at android.widget.AbsListView$AdapterDataSetObserver.onChanged(AbsListView.java:6280) 08-19 11:57:24.823: W/System.err(4962): at android.database.DataSetObservable.notifyChanged(DataSetObservable.java:37) 08-19 11:57:24.823: W/System.err(4962): at android.widget.BaseAdapter.notifyDataSetChanged(BaseAdapter.java:50) 08-19 11:57:24.823: W/System.err(4962): at android.widget.ArrayAdapter.notifyDataSetChanged(ArrayAdapter.java:286) 08-19 11:57:24.823: W/System.err(4962): at com.impact.ribony.ConversationFragment.addMessageToList(ConversationFragment.java:91) 08-19 11:57:24.823: W/System.err(4962): at com.impact.ribony.MainActivity.addMessageToFragment(MainActivity.java:344) 08-19 11:57:24.823: W/System.err(4962): at com.impact.ribony.MainActivity$2.on(MainActivity.java:183) 08-19 11:57:24.823: W/System.err(4962): at io.socket.IOConnection.on(IOConnection.java:908) 08-19 11:57:24.883: W/System.err(4962): at io.socket.IOConnection.transportMessage(IOConnection.java:697) I didn't understand this error.What can be cause this error ?

    Read the article

  • Testing for a closed socket

    - by Robert S. Barnes
    I'm trying to test for a closed socket that has been gracefully closed by the peer without incurring the latency hit of a double send to induce a SIGPIPE. One of the assumptions here is that the socket if closed was gracefully closed by the peer immediately after it's last write / send. Actual errors like a premature close are dealt with else where in the code. If the socket is still open, there will be 0 or more bytes data which I don't actually want to pull out of the socket buffer yet. I was thinking that I could call int ret = recv(sockfd, buf, 1, MSG_DONTWAIT | MSG_PEEK); to determine if the socket is still connected. If it's connected but there's no data in the buffer I'll get a return of -1 with errno == EAGAIN and return the sockfd for reuse. If it's been gracefully closed by the peer I'll get ret == 0 and open a new connection. I've tested this and it seems to work. However, I suspect there is a small window between when I recv the last bit of my data and when the peer FIN arrives in which I could get a false-positive EAGAIN from my test recv. Is this going to bite me, or is there a better way of doing this?

    Read the article

  • Java Socket - how to catch Exception of BufferedReader.readline()

    - by Hasan Tahsin
    I have a Thread (let's say T1) which reads data from socket: public void run() { while (running) { try { BufferedReader reader = new BufferedReader( new InputStreamReader(socket.getInputStream()) ); String input = reader.readLine(); } catch (IOException e) { e.printStackTrace(); } } } Another Thread (lets say T2) try to finish the program in one of its method. Therefore T2 does the following: T1.running = false; socket.close(); Here is this scenario for which i couldn't find a solution: T1 is active and waiting for some input to read i.e. blocking. context switching T2 is active and sets running to false, closes the socket context switching because T1 was blocking and T2 closed the socket, T1 throws an Exception. What i want is to catch this SocketException. i can't put a try/catch(SocketException) in T1.run(). So how can i catch it in T1's running-method? If it's not possible to catch it in T1's running, then how can i catch it elsewhere? PS: "Another question about the Thread Debugging" Normally when i debug the code step by step, i lose the 'active running line' on a context switch. Let's say i'm in line 20 of T1, context switch happens, let's assume the program continues from the 30.line of T2, but the debugger does not go/show to the 30.line of T2, instead the 'active running line' vanishes. So i lose the control over the code. I use Eclipse for Java and Visual Studio for C#. So what is the best way to track the code while debugging on a context switch ?

    Read the article

  • How to empty a socket in python?

    - by luc
    I need to empty the data on a socket (making sure that there is nothing to receive). Unfortunately, there is no function for this in the python socket module. I've implemented something this way: def empty_socket(sock): """remove the data present on the socket""" input = [sock] while 1: inputready, o, e = select.select(input,[],[], 0.0) if len(inputready)==0: break for s in inputready: s.recv(1) What do you think? Is there a better way to do that? Update: I don't want to change the socket timeout. What's why i prefer a select to a read. Update: The original question was using the 'flush' term. It seems that 'empty' is a better term. Update - 2010-02-27 : I've noticed a bug after when the pair has closed. The inputready is always filled with the sockets. I fixed that by adding a maximum number of loops. Is there a better fix?

    Read the article

  • Maintaining many socket connections with a single thread

    - by John
    Many tutorials on socket communication I see seem to use 1 thread per socket. But on a server used for online gaming, you might have 10k concurrent users - 10k threads isn't probably a wonderful idea. I came across a tool (SmartFox) which claims to use a single thread for monitoring all socket connections, potentially thousands of them. This app happens to be in Java, but I figure C++ or C# could do the same... how would you achieve this?

    Read the article

  • Read from socket

    - by Alberto
    I need to read from an AF_UNIX socket to a buffer using the function read from C, but I don't know the buffer size. I think the best way is to read N bytes until the read returns 0 (no more writers in the socket). Is this correct? Is there a way to guess the size of the buffer being written on the socket? I was thinking that a socket is a special file. Opening the file in binary mode and getting the size would help me in knowing the correct size to give to the buffer? I'm a very new to C, so please keep that in mind.

    Read the article

  • Multiplayer mobile games and coping with high latency

    - by liortal
    I'm currently researching regarding a design for an online (realtime) mobile multiplayer game. As such, i'm taking into consideration that latencies (lag) is going to be high (perhaps higher than PC/consoles). I'd like to know if there are ways to overcome this or minimize the issues of high latency? The model i'll be using is peer-to-peer (using Photon cloud to broadcast messages to all other players). How do i deal with a scenario where a message about a local object's state at time t will only get to other players at *t + HUGE_LAG* ?

    Read the article

  • Mobile Multiplayer games and coping with high latency

    - by spaceOwl
    I'm currently researching regarding a design for an online (realtime) mobile multiplayer game. As such, i'm taking into consideration that latencies (lag) is going to be high (perhaps higher than PC/consoles). I'd like to know if there are ways to overcome this or minimize the issues of high latency? The model i'll be using is peer-to-peer (using Photon cloud to broadcast messages to all other players). How do i deal with a scenario where a message about a local object's state at time t will only get to other players at *t + HUGE_LAG* ?

    Read the article

  • udp can not receive any data

    - by StoneHeart
    Here is my code Socket sck = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); sck.Bind(new IPEndPoint(IPAddress.Any, 0)); // Broadcast to find server string msg = "Imlookingforaserver:" + udp_listen_port; byte[] sendBytes4 = Encoding.ASCII.GetBytes(msg); IPEndPoint groupEP = new IPEndPoint(IPAddress.Parse("255.255.255.255"), server_port); sck.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Broadcast, 1); sck.SendTo(sendBytes4, groupEP); //Wait response from server Socket sck2 = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); sck2.Bind(new IPEndPoint(IPAddress.Any, udp_listen_port)); byte[] buffer = new byte[128]; EndPoint remoteEndPoint = new IPEndPoint(IPAddress.Any, udp_listen_port); sck2.ReceiveFrom(buffer, ref remoteEndPoint); //<<< I never pass this line I use above code to try find a server. First I broadcast a message and then I wait for a response from the server. A test I made with the server written in C++ and running in Windows Vista, client written in C# and run on the same machine with server. Problem is: The server can receive message which client broadcast, but client can not receive anything from server. I try to write a client with C++ and it work like a charm, I think my problem is in C# client.

    Read the article

  • How to determine an invalid CFSocket

    - by Chris
    Hi Everyone, how can I avoid, to send data via CFSocketSendData to an invalid socket? I've try to determine the socket state with CFSockerIsValid, but this method returns still true when the other side is close. So how can I determine if the socket is valid? In order so avoid Errors. Thank Chris

    Read the article

  • How to handle activity life cycle involving sockets in Android?

    - by Henrik
    Hello all, I have an Android activity which in turn starts a thread. In the thread I open a persistent TCP socket connection. When the socket connects to the server dynamic data is downloaded. The thread sends messages using Handler-class to the activity when data has been received. Now if the user happens to switch from portrait to landscape mode the activity gets an onDestroy call. At this moment I close the socket and stop the thread. When Android has switched landscape mode it calls onCreate yet again and I have to do a socket re-connect. Also, all of the data the activity received needs to be downloaded once more because the server does not have the ability to know what has been sent before, i.e. there is no "resume" feature. Thus the problem is that there is alot of data which is resent all the time when landscape mode is changed. What are my options here? Should I create a service which handles the socket traffic towards the server thus I always got all the data which the server has sent in the service. Or should I disable landscape mode all together perhaps? Or would my best bet be to rewrite my server which is a VERY BIG job :-) All input is welcome :-) / Henrik

    Read the article

  • C# udp can not receive any data

    - by StoneHeart
    here is my code Socket sck = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); sck.Bind(new IPEndPoint(IPAddress.Any, 0)); // Broadcast to find server string msg = "Imlookingforaserver:" + udp_listen_port; byte[] sendBytes4 = Encoding.ASCII.GetBytes(msg); IPEndPoint groupEP = new IPEndPoint(IPAddress.Parse("255.255.255.255"), server_port); sck.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Broadcast, 1); sck.SendTo(sendBytes4, groupEP); //Wait response from server Socket sck2 = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); sck2.Bind(new IPEndPoint(IPAddress.Any, udp_listen_port)); byte[] buffer = new byte[128]; EndPoint remoteEndPoint = new IPEndPoint(IPAddress.Any, udp_listen_port); sck2.ReceiveFrom(buffer, ref remoteEndPoint); //<<< I never pass this line I use above code to try find a server. First i broadcast a message and then i wait response from server. A test i made with the server written in c++ and running in windows vista, client written in C# and run on the same machine with server. Problem is: The server can receive message which client broadcast. But client can not receive anything from server. I try to write a client with c++ and it work like a charm, i think my problem is in C# client.

    Read the article

  • Java: Efficiency of the readLine method of the BufferedReader and possible alternatives

    - by Luhar
    We are working to reduce the latency and increase the performance of a process written in Java that consumes data (xml strings) from a socket via the readLine() method of the BufferedReader class. The data is delimited by the end of line separater (\n), and each line can be of a variable length (6KBits - 32KBits). Our code looks like: Socket sock = connection; InputStream in = sock.getInputStream(); BufferedReader inputReader = new BufferedReader(new InputStreamReader(in)); ... do { String input = inputReader.readLine(); // Executor call to parse the input thread in a seperate thread }while(true) So I have a couple of questions: Will the inputReader.readLine() method return as soon as it hits the \n character or will it wait till the buffer is full? Is there a faster of picking up data from the socket than using a BufferedReader? What happens when the size of the input string is smaller than the size of the Socket's receive buffer? What happens when the size of the input string is bigger than the size of the Socket's receive buffer? I am getting to grips (slowly) with Java's IO libraries, so any pointers are much appreciated. Thank you!

    Read the article

  • JavaScript socket vs. Flash socket?

    - by Dr.Dredel
    Steve Jobs just posted this article on why Apple rejects Flash... http://www.apple.com/hotnews/thoughts-on-flash/ I agree that javascript and css can be used to replicate some of Flash's animation, though Flash does all sorts of scaling and tweening that is incredibly powerful, and I'm not sure that there's anything comparable in javascript, if there is, I certainly haven't seen it. However, my question is about the socket. Flash has an incredibly powerful openSocket class that allows you to connect to a server and have the server and the client talk back and forth to one another. As far as I know there is no equivalent class in Javascript. Am I mistaken? Is there some secret mystery Ajax class that replicates the openSocket? If not, then that feature alone makes Flash an invaluable tool. I'm interested in all answers though... and yes this IS a programming question! :)

    Read the article

  • Pairing Sony bluetooth headphones with my PC, under Windows 7

    - by jonathanconway
    Hi there, I have the Sony DR-BT50 wireless headphones. I've been able to successfully pair them to my iPhone and play music through them, but no such luck with my PC. I can add it to the bluetooth devices, but when the "Driver Software Installation" screen comes up, I get a red X and "No driver found". Any ideas how to fix this? (I have a bluetooth keyboard & mouse paired successfully, so it's not a problem with my laptop's bluetooth.)

    Read the article

  • Pairing Sony bluetooth headphones with my laptop

    - by jonathanconway
    Hi there, I have the Sony DR-BT50 wireless headphones. I've been able to successfully pair them to my iPhone and play music through them, but no such luck with my PC. I can add it to the bluetooth devices, but when the "Driver Software Installation" screen comes up, I get a red X and "No driver found". Any ideas how to fix this? (I have a bluetooth keyboard & mouse paired successfully, so it's not a problem with my laptop's bluetooth.)

    Read the article

  • eSata plugged into Sata socket via adaptor cable very slow

    - by Jon
    Why would an external eSata Drive (xSonic with 500Gb notebook Hard Drive) run ok on a Silicon Image based PCI-E to eSata adaptor at about 35MB/s, But then run really slow when plugged into NForce4 Sata socket via cable? I have another version of the problem with Really slow 1MB/s!!! performance on a ASUS P5K Pro Motherboard with E8400 CPU. This time the same card is plugged into a PCI-E socket. The same eSata drive is plugged into the Esata port on the card. All this is running on Windows XP Pro 32bit. Any suggestions on how to diagnose the problems??

    Read the article

  • gunicorn + django + nginx unix://socket failed (11: Resource temporarily unavailable)

    - by user1068118
    Running very high volume traffic on these servers configured with django, gunicorn, supervisor and nginx. But a lot of times I tend to see 502 errors. So I checked the nginx logs to see what error and this is what is recorded: [error] 2388#0: *208027 connect() to unix:/tmp/gunicorn-ourapp.socket failed (11: Resource temporarily unavailable) while connecting to upstream Can anyone help debug what might be causing this to happen? This is our nginx configuration: sendfile on; tcp_nopush on; tcp_nodelay off; listen 80 default_server; server_name imp.ourapp.com; access_log /mnt/ebs/nginx-log/ourapp-access.log; error_log /mnt/ebs/nginx-log/ourapp-error.log; charset utf-8; keepalive_timeout 60; client_max_body_size 8m; gzip_types text/plain text/xml text/css application/javascript application/x-javascript application/json; location / { proxy_pass http://unix:/tmp/gunicorn-ourapp.socket; proxy_pass_request_headers on; proxy_read_timeout 600s; proxy_connect_timeout 600s; proxy_redirect http://localhost/ http://imp.ourapp.com/; #proxy_set_header Host $host; #proxy_set_header X-Real-IP $remote_addr; #proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; #proxy_set_header X-Forwarded-Proto $my_scheme; #proxy_set_header X-Forwarded-Ssl $my_ssl; } We have configure Django to run in Gunicorn as a generic WSGI application. Supervisord is used to launch the gunicorn workers: home/user/virtenv/bin/python2.7 /home/user/virtenv/bin/gunicorn --config /home/user/shared/etc/gunicorn.conf.py daggr.wsgi:application This is what the gunicorn.conf.py looks like: import multiprocessing bind = 'unix:/tmp/gunicorn-ourapp.socket' workers = multiprocessing.cpu_count() * 3 + 1 timeout = 600 graceful_timeout = 40 Does anyone know where I can start digging to see what might be causing the problem? This is what my ulimit -a output looks like on the server: core file size (blocks, -c) 0 data seg size (kbytes, -d) unlimited scheduling priority (-e) 0 file size (blocks, -f) unlimited pending signals (-i) 59481 max locked memory (kbytes, -l) 64 max memory size (kbytes, -m) unlimited open files (-n) 50000 pipe size (512 bytes, -p) 8 POSIX message queues (bytes, -q) 819200 real-time priority (-r) 0 stack size (kbytes, -s) 8192 cpu time (seconds, -t) unlimited max user processes (-u) 1024 virtual memory (kbytes, -v) unlimited file locks (-x) unlimited

    Read the article

  • SSH issues: Read from socket failed: Connection reset by peer

    - by nitins
    I compiled OpenSSH_6.6p1 on one of our server. I am able login via SSH to the upgraded server. But I am not able to connect to other servers running OpenSSH_6.6p1 or OpenSSH_5.8 from this. While connecting I am getting an error as below. Read from socket failed: Connection reset by peer On the destination server in the logs, I am seeing it as below. sshd: fatal: Read from socket failed: Connection reset by peer [preauth] I tried specifying the cipher_spec [ ssh -c aes128-ctr destination-server ] as mentioned in here and was able to connect. How can configure ssh to use the cipher by default? Why is the cipher required here?

    Read the article

< Previous Page | 12 13 14 15 16 17 18 19 20 21 22 23  | Next Page >