sockets

What are some possible causes of iPhone rejecting UDP packet?

On iPhone, I am running an app with AsyncUdpSocket library to take care of UDP networking. I have tested it. I can send UDP packet from my iPhone to a server that runs Java program accepting UDP correctly. However, when it is the other way around, Java program's UDP message doesn't get through to iPhone. So I decided to test the library...

How to instantiate a Socket class in Java?

I know that the Socket class can be instantiated in this way (as an example): new Socket("taranis", 7); where "taranis" is the name of the server in a local network. In this respect I have two questions: 1. If my computers do not form a local network but are connected to the Internet, can I use the IP addresses of computers to instan...

How to dynamically allocate buffer for receiving UDP socket (VB.Net)

A friend and I are working on a project where we're required to build a reliable UDPclient/server using VB.Net. We have things working well, but one thing that still eludes us is how to dynamically allocate a (byte) buffer for the incoming data. Right now we have to hard code a maximum value/MTU (or use a really large buffer size and r...

Reading socket reply in loop

Hello, I have: char buf[320]; read(soc, buf, sizeof(buf)); //print buf; However, sometimes the reply is much bigger then 320 characters, so I'm trying to run the read in a loop to avoid taking up too much memory space. I tried read(soc, buf, sizeof(buf)) but that only prints the same first x characters over again. How would I print ...

Network Communication Question

I would like to ask a question about network communication. The Question is: A server uses the socket interface on the Lunix platform, and a client uses Winock on the Windows platform. Can they communicate? Explain briefly. I guess the answer is NO. I guess it is due to the compatibility between 2 different socket interface?! Bu...

Inet Socket and Socket?

Can anybody tell me the difference between a INET Socket and any other socket? Is there a C# library that will allow one to work with INET Sockets? I've attempted to find what it is, but I haven't found anything very useful. I'm suspecting it's something from the UNIX world. ...

How to get client IP from java server through xinetd ?

Hi, I am running a small java server through xinetd superserver. I'd like to get the originating client IP but I can't because streams are between xinetd and java (stin/stdout). Does somebody know how to get the client IP, without looking to xinetd logfile ? (seems a bad solution to me) Thanks ! ...

File Descriptor Sharing between Parent and Pre-forked Children

In Unix Network Programming there is an example of a Pre-forked server which uses message passing on a Unix Domain Pipe to instruct child processes to handle an incoming connection: for ( ; ; ) { rset = masterset; if (navail <= 0) FD_CLR(listenfd, &rset); /* turn off if no available children */ nsel = Select(maxfd...

How to get the status of an Asterisk Server using a Socket - Python

I'm trying to get the status of an Asterisk Server using a python socket but nothing happens. Here is my code: import socket s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) HOST = '192.168.1.105' PORT = 5038 s.connect((HOST, PORT)) params = """Action: login Events: off Username: admin Secret: mypass Action: status Action: Logo...

Which is the best way to monitor USB port with flex or flash?

Hi, I want to write an application that monitor the USB port, and when something is connected should show the contents of the drive (image viewer) automatically. there is any way to do that with Flex/Flash directly? or i might program another application in C in order to monitor the USB port and then comunicate with the front-end appli...

Can I have IO exception when I create a server socket in Java?

I have the following code: Socket clientSocket = null; try { clientSocket = serverSocket.accept(); } catch (IOException e) { System.err.println("Accept failed."); System.exit(1); } The code is taken from a java.sun.com. I have several questions concerning the above given short part of the code. Why do we want to catch an I...

.NET newbie socket problem

I have a C# client/server network program I've written using TCPListener and TCPClient classes. The server is reading everything from the client (small amounts of xml) just fine until I try to send a large file (100k) back to the client. I'm using stream functions for both client and server with non-blocking socket functions. When I do...

Proper length of an AF_UNIX socket when calling bind()

bind() needs a length of the sockaddr structure you've given it. Now, for unix sockets, sockaddr_un is used What's the proper ways of calculating the length of this when you've filled in the sun_path member ? I've seen multiple approaches: socklen_t len = sizeof(sockaddr_un); socklen_t len = offsetof(sockaddr_un,sun_path) + strlen(addr...

How can I code a server/client video and audio streaming application?

Hi guys, I have to create a client/server system to stream video and audio. It would be very simple. Like youtube style. The server should attend clients providing a list of medias first and waiting the choice of each client to start streaming the media. Until create a socket and showing a simple list I'm on it ;) But I don't know which ...

cURL - "hanging" socket connection on Linux

...

How to fix java.net.SocketException: Broken pipe ?

Hi, I am using apache commons http client to call url using post method to post the parameters and getting the below error rarely. When I explore the reason, didnt get the exact reason for the cause. Can anyone suggest a way to fix this? java.net.SocketException: Broken pipe at java.net.SocketOutputStream.socketWrite0(Native M...

Getting data to the client in an Java MMO

Hi, I'm trying to make an online MMO in Java. It will be a simple one where you get a character and can move around and shoot other players, all in top-down 2D. The server will be multithreaded and in Java, and the client will also be in Java. The client will send all user input to the server and the server will handle all the logic (mov...

Setting DSCP using IP_TOS stopped working on Windows XP

Hi, I had this working a few weeks ago. I use the old setsocopt with IP_TOS and the DisableUserTOSSetting=0 to set the DSCP in outbound RTP traffic. Now it does not work anymore on my Windows XP machine. Using QoS packet scheduler and gpedit.msc does work but is not my preferred solution. I have checked the registry flag many times no...

How do I log in to a site remotely using a script?

Hi all, I'm trying to write a script to automate a repetitive task I currently do manually. I would like to log in to a site remotely and inspect the returned page. I've been doing this by sending a direct POST request (the site is PHP, I'm pretty sure it's Joomla) with my login details and data for the other fields of the form from t...

Flash / AS2 Socket Policy File issue

I've been trying to establish a connection between my flash client and java server for a few days now, but having trouble with the socket policy server. I've read a lot of info online (including the Adobe guide on how to create one) but still I can't get it to connect, other than in the "Test Movie" option in CS3. The source for the cl...