Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 112

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 112

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 112

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 112
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3368: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3370: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3371: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3372: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
OrbWorks Community Forum • View topic - Sockets & TCP Connection
Page 1 of 1

PostPosted: Fri Mar 18, 2005 8:52 am
by wisecom
I have read through the forum and found a few topics on opening a socket to establish a TCP connection to the Internet. I want to try to open a socket and connect to another machine on the network,from my PDA. I have most of the code written (using pocketc) for the application I am creating but I am unsure about the socket part. Is the pocketcnetlib library my best option here or is there a way I can write a simple program to open a socket, connect and recieve a confirmation that I have connected?
ANy help appreciated, thanks.

PostPosted: Sat Mar 19, 2005 3:37 am
by dewey
PocketC has built-in support for sockets (see the Networking section in Functions.html for the documentation).

Call netopen(), sockopen(), and then sockconnect(). If sockconnect() returns 0, you are connected.

PostPosted: Mon Mar 21, 2005 8:24 am
by wisecom
Thanks dewey

PostPosted: Tue Mar 22, 2005 3:37 pm
by wisecom
Right, I have written the code and am pretty sure it will work(fingers crossed!). Anyone know of a quick way to test client-side socket requests, in other words, is there anyway to setup a quick server on a laptop?

PostPosted: Thu Mar 24, 2005 2:31 pm
by dewey
I personally use python to do quick tools like this. Here is a script that waits for a connection and prints out whatever it receives:
Code: Select all
from socket import *
from sys import stdout
from time import sleep

def echosrv():
    s = socket(AF_INET, SOCK_STREAM)
    s.bind(("", 12345))
    s.listen(1)
    rs, raddr = s.accept()
    while 1:
        str = rs.recv(1)
        stdout.write(str)
        sleep(1)

echosrv()

PostPosted: Tue Mar 29, 2005 2:58 pm
by wisecom
Once again dewey thanks for your help. I tried this and it worked great.

PostPosted: Wed Apr 06, 2005 4:04 pm
by wisecom
I am trying to get the client side socket working now with some code I found in this forum but I am getting a Addr:1141 Func Main Invalid handle value error message, any idea where my code is wrong?

@cid "AFJC";
@name "socket";
@dbname "socket";
@ver "1.0";
@licon1 "Pwklg.bmp";
@sicon1 "pwkSm.bmp";

#include "neterror.h"
main() {
int err, s;

string name, addr, index;
puts("Started\n" );
err = netopen();
if (err == 0) {
puts("net opened");
if (sockopen(s)==0)
{
puts("before connect");
if(sockconnect(s, 1) == 0)
{
puts("connected");
}
}
} else {
puts("Failed to open network: " + neterror(err) + "\n");
}
}

PostPosted: Thu Apr 07, 2005 5:00 am
by dewey
The problem is that sockopen() takes a pointer to an int, so that it can return the new socket handle.

if (sockopen(&s)==0) ...