sockets

How to make socket connection to a server where server is accessed only through another server in Java applets?

I have a server and client program. client is a java applet. Previously I could run the server program in the server and the client successfully connected to the server program through the socket's proper port. Now, I switched to a new server and I have problem with this server. Direct connection (ssh) to this server (let say it is serv...

Does closing the inputstream of a socket also close the socket connection?

In Java API, Socket socket = serverSocket.accept(); BufferedReader fromSocket = new BufferedReader(new InputStreamReader(socket.getInputStream())); PrintWriter toSocket = new PrintWriter(socket.getOutputStream()); //do sth with fromSocket ... and close it fromSocket.close(); //then write to socket again toSocket.print("is socket conne...

How to save data in TCP socket connection session?

Hello all, I want to code a server in java which will accept the information from many devices and store the information in database. The devices will keep sending the packets. The first packet will contain the unique deviceId, and after that only data related to the device. I want to save data along with deviceId. Up to now, I could dev...

C#: Unable to receive large data on TCP Server

hi. I have created a TCP server. I am facing one problem. my TCP Server is not receiving data larger than 30000 bytes. here is code to receive data MAX_TCP_DATA = 64000 private void Process() { if (client.Connected == true) { log.InfoFormat("Client connected :: {0}", client.Client.Remot...

C++ weird RAW sockets and iptables issue...

With reference to http://stackoverflow.com/questions/3951043/c-iptables-redirection-forming-separate-packets, I am facing an extremely peculiar problem now. I am trying to redirect all incoming traffic on UDP port 5060 to port 56790, and all outgoing traffic from 5060 to the port 56789. I used these iptables rules: iptables -t nat -I PR...

How can i manage session in chat or game server?

I wanna create communication server as the following: public interface ICommnuicationServer { void Send(object sessionId, object message); void Send(IList<object> sessionIds, object message); void Broadcast(object message); } How can i manage and store this session by sessionId? ...

AF_INET for IPC in windows

I wish to know that If protocol family AF_INET is used for local communication (IPC) in windows systems. (with loopback interface) will it be able to give performance same as AF_UNIX in unix. I tried for Named pipe in windows but it doesn't seems to me working for my case. AF_INET when used it will go through the TCP/IP stack. which wil...

Realtime TCP/IP Socket Server on Amazon EC2

Hello everyone, I am planning to move a game server of mine to Amazon EC2. Right now the actual server runs on .Net Framework 3.5 on a windows dedicated server. Since it is a personal side-project, it's quite expensive to have a fully dedicated server to that, therefore I would like to move it to the cloud (Amazon EC2 or maybe Windows A...

missing messages when reading with non-blocking udp

I have problem with missing messages when using nonblocking read in udp between two hosts. The sender is on linux and the reader is on winxp. This example in python shows the problem. Here are three scripts used to show the problem. send.py: import socket, sys s = socket.socket(socket.AF_INET,socket.SOCK_DGRAM) host = sys.argv[1] s.send...

Manipulate File Descriptors for select.select in Python

Hello everyone, I have an itching problem I know could be solved using many different ways, but I would still like to know if the following approach is possible in Python. Suppose I have some socket I am constantly waiting for input on, and there is some condition that eventually terminates the whole program. I want to do it in a BLOCK...

chat room using socket programming

i am writing program for chat room on client side i had wirtten clientSocket = new Socket('127.0.0.1',5432); socketInputBuffer = new BufferedReader(new InputStreamReader(clientSocket.getInputStream())); socketOutputBuffer = new BufferedWriter(new OutputStreamWriter(clientSocket.getOutputStream())); systemBuffer = new BufferedReader(new ...

Android - Socket time out

I have some strange socket behavior going on. I've set an timeout of 5 seconds using setSoTimeout. This should be plenty of time in my situation. According to online java documentation a SocketTimeoutException should be thrown if it times out. It also says that the socket is still valid. So I want to catch it and then continue. How...

Android Socket + ObjectOutputStream not working correctly

Hey guys. I am developing a client/server program where the client is an android device. The server has a listener class that reads an object from the input stream. I created a client software for another COMPUTER that sends a small object over a local network. Computer to Computer works perfectly fine, i read the object and printed the...

Node.js: Connecting to a Server Using Sockets

I'm just starting to play with Node.js today, and thought I'd start with what I thought would be a simple script: Connecting to a server via sockets, and sending a bit of data, and receiving it back. I'm creating a command line utility. Nothing in the browser. An example of a server would be memcached, beanstalkd, etc. It seems the net ...

Dynamically get "outgoing" IP address with PHP

PHP gives a different IP address for my site from $_SERVER['SERVER_ADDR'] than other sites see when I access them through cURL (or file_get_contents, or whatever). I know this because I had my site download whatismyip.com and it gives something different than that server variable. Adding to this annoyance is the fact that the outgoing ...

IO#read blocks on non-blocking socket?

Ruby 1.8.7. I'm calling read on a socket which has been opened and connected with: socket = Socket.new(AF_INET, SOCK_STREAM, 0) sockaddr = Socket.sockaddr_in(mp.port, mp.ip_address.ip) begin socket.connect_nonblock(sockaddr) [...] The connection is confirmed by calling select() and then connecting a second time looking for Errno::E...

JAVA sockets - execute PJL command

In Java, I am trying to connect to a printer(Canon iR5050 PCL6) using Sockets, using the host IP with port as 9010. I want to get the status of the printer using PJL command. I write the PJL command (\x1B%-12345X@PJL INFO USTATUS \r\n\x1B%-12345X\r\n) to the socket output stream and try to read the status of the printer from the input st...

When does EndReceive return zero bytes

I'm trying to get a better handle on using sockets asynchronously. According to this article, http://msdn.microsoft.com/en-us/library/bew39x2a(v=VS.85).aspx, I ought to be able to check the number of bytes returned by EndReceive, and if it's zero, I know I have all the data, and if it's non-zero, there may or may not be more data coming....

Weird behaviour with sockets on localhost

I have two .net applications communicating with sockets on port 5672 and everthing works fine. On server side, i open the connection with this simple code lines: IPAddress localAddr = Dns.GetHostEntry("localhost").AddressList[0]; TcpListener socket = new TcpListener(localAddr, 5672); socket.Start(); If i try to launch another...

bypass silverlight tcp port restrictions

Hi, Is there a way to bypass the Silverlight port range (4502-4532) security restriction for TCP connections? Maybe a 3rd party implementation of TcpSocket that does not enforce the 4502-4532 port range? ...