Search Results

Search found 3513 results on 141 pages for 'raw sockets'.

Page 3/141 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • What Parallel computing APIs make good use of sockets?

    - by Ole Jak
    My program uses sockets, what Parallel computing APIs could I use that would help me without obligating me to go from sockets to anything else? When we are on a cluster with a special, non-socket infrastructure system this API would emulate something like sockets but using that infrastructure (so programs perform much faster than on sockets, but still use the sockets API).

    Read the article

  • Qt Sockets and Endianness

    - by cake
    Hello I'm writing a program that uses QUdpSocket for transmiting data over the network. This is my first socket program, and I've come across an interesting problem called Endianness. My actual question in, do I have to worry about Endianness when I'm using QNetwork as my sockets library? If I do have to worry, what do I have to do to properly avoid Endianness problems? Thanks in advance.

    Read the article

  • checksum in raw sockets and pcap [closed]

    - by hero
    i am using pcap library to sniff some packets, change their tcp data , and then inject my packet on the network. my question is: if i changed in the tcp data, should i recalculate the length field in the tcp header? should i also change the checksum? i read in a page on how to create raw sockets that if you set the tcp_checksum to 0, the kernel will automatically calculate it and fill it, is this true for windows machines also?

    Read the article

  • C# Secure Sockets (SSL)

    - by Matthias Vance
    LS, I was planning on writing a wrapper around the System.Net.Sockets.Socket class, because I didn't feel like using the SSLStream class because I wanted to maintain backwards compatibility with other programs. I found an article which does exactly what I want, but on Windows Mobile. (Link: Enable SSL for managed socket on windows mobile) Quote: My first surprise was that SetSocketOption takes a SocketOptionName enum value as the second parameter, but this enum doesn’t have the equivalent of SO_SECURE. However, C# was nice enough to let me cast an arbitrary integer value to the enum I needed. I tried to do the same, but it doesn't work. Code: private const ushort SO_SECURE = 0x2001; private const ushort SO_SEC_SSL = 0x2004; this.SetSocketOption(SocketOptionLevel.Socket, (SocketOptionName) SO_SECURE, SO_SEC_SSL); Error: An unknown, invalid, or unsupported option or level was specified in a getsockopt or setsockopt call Is there a way to work around this? Kind regards, Matthias Vance

    Read the article

  • WCF VS. Sockets

    - by kite
    Hello, I would like to know which of WCF or .NET Sockets is the more efficient and the more recommended in a game developpment scenario. Here are the different parts of the game : -a client/server communication to play on the internet -peer to peer on local network. I would like to know which technology you would use on these parts (wcf on both, socket on both, wcf on one and socket on the other...) and why, if possible. The game involved doesn't require a high communication frequency (3-4 per second is enough). Thanks, KiTe

    Read the article

  • Java: Sockets or RMI?

    - by StillLearning
    Hi, I need to separate our application into a light-weight gui application and a business logic application. This won't be a client/server setup as such, as the 'server' component will only have one client. The other limitation in the application is that it has only one entry/exit point. Therefore if we were to use RMI, it would only ever be on one function. All form data is already wrapped up into a string and passed through one transport area. Should I just use Java Sockets to enhance this application, or go with RMI? Or some other Java technology? I made a previous post outlining the requirements of our application, however it went unanswered. http://stackoverflow.com/questions/2604528/terminal-panel-pc-single-server-solution-client-server-or-rdp Cheers.

    Read the article

  • Using PHP Sockets as a "Relay"

    - by Trikks
    Hi! I'm trying to create a left php socket-server < right relation with php sockets. Let's say that I have a server-daemon on the left side, like a vnc-server that connects to the socket-server. On the right side I've got a client that want to connect to the left server-daemon, but it has to be done through the socket-server. The server environment is a fully featured Linux or Mac OS X Server host with php5.3. Any idéas? Thanks / Trikks

    Read the article

  • Unix Sockets in Go

    - by marketer
    I'm trying to make a simple echo client and server that uses Unix sockets. In this example, the server can receive data from the client, but it can't send the data back. If I use tcp connections instead, it works great: Server package main import "net" import "fmt" func echoServer(c net.Conn) { for { buf := make([]byte, 512) nr, err := c.Read(buf) if err != nil { return } data := buf[0:nr] fmt.Printf("Received: %v", string(data)) _, err = c.Write(data) if err != nil { panic("Write: " + err.String()) } } } func main() { l, err := net.Listen("unix", "/tmp/echo.sock") if err != nil { println("listen error", err.String()) return } for { fd, err := l.Accept() if err != nil { println("accept error", err.String()) return } go echoServer(fd) } } Client package main import "net" import "time" func main() { c,err := net.Dial("unix","", "/tmp/echo.sock") if err != nil { panic(err.String()) } for { _,err := c.Write([]byte("hi\n")) if err != nil { println(err.String()) } time.Sleep(1e9) } }

    Read the article

  • How can I "interconnect" two sockets in Linux?

    - by Vi
    There are two connected sockets. How can I interconnect them? Data appeared on the one socket should be written to the other. EOF/FIN should propogate well. If one is half-closed, the other should also be half-closed. int client = get_connected_client_socket(); int proxy = get_connected_proxy_socket(); negotiate_with_proxy(proxy); iterconnect(client, proxy); // Now forgot about both client and proxy. // System should handle IO/shutdown/close. // Ideally even without any support of the user-space process. Can Linux do it? Can it be done by tricking connection tracking to change tracking status of existing connection? @related http://stackoverflow.com/questions/2673975/determine-how-much-can-i-write-into-a-filehandle-copying-data-from-one-fh-to-the

    Read the article

  • Chat Server with sockets in C

    - by Andrew
    I'm trying to write a chat server in C that allows communication between two clients using POSIX sockets. I'm not sure I have a good grasp on this concept or how I should set up the communication protocol between the clients and the server. I know I need one socket to bind() the server port to so I can accept incoming connections from clients, but in order to have two clients connected at the same time do I need to create a socket for each of these clients when I accept() or should I accept() a client and then fork() so I can have another client accept? I'm not worried about concurrent chatting yet, it's more of a ping-pong approach where the clients need to wait for a recv() after they send() before they can type a new message.

    Read the article

  • Using gprof with sockets

    - by Chris
    I have a program I want to profile with gprof. The problem (seemingly) is that it uses sockets. So I get things like this: ::select(): Interrupted system call I hit this problem a while back, gave up, and moved on. But I would really like to be able to profile my code, using gprof if possible. What can I do? Is there a gprof option I'm missing? A socket option? Is gprof totally useless in the presence of these types of system calls? If so, is there a viable alternative? EDIT: Platform: Linux 2.6 (x64) GCC 4.4.1 gprof 2.19

    Read the article

  • C# Asynchronous Sockets questions.

    - by ccppjava
    Based on my reading and testing, with asynchronous sockets, the socket itself can be passed using state object (IAsyncResult result), also if store the socket as a private field, it would be captured by the callback methods. I am wondering how the IAysnResult is kepted between the BeginXXX and ReceiveXXX? It looks to me that after the BeginXXX call and the method ends, the state object would be disposed by GC if there is no reference to it. In the case of private field, how the private field is shared between threads? (As far as I know, a callback is executed using a thread from the default thread pool, which would be considered as a new thread.) Many thanks, hope the questions themselves are clear.

    Read the article

  • closing sockets on linux and windows

    - by robUK
    Hello, gcc 4.4.4 c89 Visual Studio VC++ 2008 I am writing a cross platform client server application. It will run on both linux and windows. However, I am just wondering what I have done for closing the sockets is correct. I close the file descriptor. However, if there is a problem with closing it. What is the best way to handle this. Maybe some data is still being sent or received? Many thanks for any advice, if(close(sockfd) == -1) { #if defined ( _WIN32 ) fprintf(stderr, "[ %d ] [ %s ] [ %s ] [ %d ]\n", WSAGetLastError(), strerror(errno), __func__, __LINE__); #elif( __linux__ ) fprintf(stderr, "[ %s ] [ %s ] [ %d ]\n", strerror(errno), __func__, __LINE__); #endif return CS_FAILURE; }

    Read the article

  • Injecting raw TCP packets with Python

    - by Evgeniy Arbatov
    Hello! What would be a suitable way to inject a raw TCP packet with Python? For example, I have the payload consisting of hexadecimal numbers and I want to send that sequence of hexadecimal numbers to a network daemon: so that if I choose to send 'abcdef', I see 'abcdef' on the wire too. But not '6162636566' as in the case of: new = socket.socket(socket.AF_INET, socket.SOCK_STREAM) new.connect(('127.0.0.1', 9999)) new.send('abcdef') Can I use Python's SOCK_RAW for this purpose? If so, can you give me an example of sending raw TCP packets with SOCK_RAW (since I did not get it working myself) Thanks! Evgeniy

    Read the article

  • Raw socket sendto() failure in OS X

    - by user37278
    When I open a raw socket is OS X, construct my own udp packet (headers and data), and call sendto(), I get the error "Invalid Argument". Here is a sample program "rawudp.c" from the web site http://www.tenouk.com/Module43a.html that demonstrates this problem. The program (after adding string and stdlib #includes) runs under Fedora 10 but fails with "Invalid Argument" under OS X. Can anyone suggest why this fails in OS X? I have looked and looked and looked at the sendto() call, but all the parameters look good. I'm running the code as root, etc. Is there perhaps a kernel setting that prevents even uid 0 executables from sending packets through raw sockets in OS X Snow Leopard? Thanks.

    Read the article

  • Sync Vs. Async Sockets Performance in C#

    - by Michael Covelli
    Everything that I read about sockets in .NET says that the asynchronous pattern gives better performance (especially with the new SocketAsyncEventArgs which saves on the allocation). I think this makes sense if we're talking about a server with many client connections where its not possible to allocate one thread per connection. Then I can see the advantage of using the ThreadPool threads and getting async callbacks on them. But in my app, I'm the client and I just need to listen to one server sending market tick data over one tcp connection. Right now, I create a single thread, set the priority to Highest, and call Socket.Receive() with it. My thread blocks on this call and wakes up once new data arrives. If I were to switch this to an async pattern so that I get a callback when there's new data, I see two issues The threadpool threads will have default priority so it seems they will be strictly worse than my own thread which has Highest priority. I'll still have to send everything through a single thread at some point. Say that I get N callbacks at almost the same time on N different threadpool threads notifying me that there's new data. The N byte arrays that they deliver can't be processed on the threadpool threads because there's no guarantee that they represent N unique market data messages because TCP is stream based. I'll have to lock and put the bytes into an array anyway and signal some other thread that can process what's in the array. So I'm not sure what having N threadpool threads is buying me. Am I thinking about this wrong? Is there a reason to use the Async patter in my specific case of one client connected to one server?

    Read the article

  • Sync Vs. Async Sockets Performance in .NET

    - by Michael Covelli
    Everything that I read about sockets in .NET says that the asynchronous pattern gives better performance (especially with the new SocketAsyncEventArgs which saves on the allocation). I think this makes sense if we're talking about a server with many client connections where its not possible to allocate one thread per connection. Then I can see the advantage of using the ThreadPool threads and getting async callbacks on them. But in my app, I'm the client and I just need to listen to one server sending market tick data over one tcp connection. Right now, I create a single thread, set the priority to Highest, and call Socket.Receive() with it. My thread blocks on this call and wakes up once new data arrives. If I were to switch this to an async pattern so that I get a callback when there's new data, I see two issues The threadpool threads will have default priority so it seems they will be strictly worse than my own thread which has Highest priority. I'll still have to send everything through a single thread at some point. Say that I get N callbacks at almost the same time on N different threadpool threads notifying me that there's new data. The N byte arrays that they deliver can't be processed on the threadpool threads because there's no guarantee that they represent N unique market data messages because TCP is stream based. I'll have to lock and put the bytes into an array anyway and signal some other thread that can process what's in the array. So I'm not sure what having N threadpool threads is buying me. Am I thinking about this wrong? Is there a reason to use the Async patter in my specific case of one client connected to one server?

    Read the article

  • C# Accepting sockets in async fasion - best practices

    - by psulek
    What is the best way to accept new sockets in async way. First way: while (!abort && listener.Server.IsBound) { acceptedSocketEvent.Reset(); listener.BeginAcceptSocket(AcceptConnection, null); bool signaled = false; do { signaled = acceptedSocketEvent.WaitOne(1000, false); } while (!signaled && !abort && listener.Server.IsBound); } where AcceptConnection should be: private void AcceptConnection(IAsyncResult ar) { // Signal the main thread to continue. acceptedSocketEvent.Set(); Socket socket = listener.EndAcceptSocket(ar); // continue to receive data and so on... .... } or Second way: listener.BeginAcceptSocket(AcceptConnection, null); while (!abort && listener.Server.IsBound) { Thread.Sleep(500); } and AcceptConnection will be: private void AcceptConnection(IAsyncResult ar) { Socket socket = listener.EndAcceptSocket(ar); // begin accepting next socket listener.BeginAcceptSocket(AcceptConnection, null); // continue to receive data and so on... .... } What is your prefered way and why?

    Read the article

  • UDP sockets in ad hoc network (Ubuntu 9.10)

    - by Ekhiotz
    Hi! I am using BSD sockets in Ubuntu 9.10 to send UDP packets in broadcast with the following code: sock_fd = socket(PF_INET,SOCK_DGRAM,IPPROTO_UDP); //sock_fd=socket(AF_INET,SOCK_DGRAM,0); receiver_addr.sin_family = PF_INET; //does not send with broadcast in ad hoc receiver_addr.sin_addr.s_addr = htonl(INADDR_BROADCAST); inet_aton("169.254.255.255",&receiver_addr.sin_addr); receiver_addr.sin_port = htons(port); int broadcast = 1; // this call is what allows broadcast packets to be sent: if (setsockopt(sock_fd, SOL_SOCKET, SO_BROADCAST, &broadcast, sizeof broadcast) == -1) { perror("setsockopt (SO_BROADCAST)"); exit(1); } ret=sendto(sock_fd, packet, size, 0,(struct sockaddr*)&receiver_addr,sizeof(receiver_addr)); Note that is not all the code, it is only to have an idea. The program sends all the data with INADDR_BROADCAST if I am connected to an infrastructure wireless network. However, if my laptop is connected to an ad-hoc network, it is able to receive all the data, but not to send it. I have solved the problem using the 169.254.255.255 broadcast address, but I would like to know what is going on. Thank you in advance!

    Read the article

  • Using Threads to Handle Sockets

    - by user340468
    I am working on a java program that is essentially a chat room. This is an assignment for class so no code please, I am just having some issues determining the most feasible way to handle what I need to do. I have a server program already setup for a single client using threads to get the data input stream and a thread to handle sending on the data output stream. What I need to do now is create a new thread for each incoming request. My thought is to create a linked list to contain either the client sockets, or possibly the thread. Where I am stumbling is figuring out how to handle sending the messages out to all the clients. If I have a thread for each incoming message how can I then turn around and send that out to each client socket. I'm thinking that if I had a linkedlist of the clientsockets I could then traverse the list and send it out to each one, but then I would have to create a dataoutputstream each time. Could I create a linkedlist of dataoutputstreams? Sorry if it sounds like I'm rambling but I don't want to just start coding this, it could get messy without a good plan. Thanks!

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >