Hello,

I mean that you have to take a look to the class that I mentioned in my last mail. There you will see that in order to connect to SerialForwarder application (I remember that you were using c-based version) you have to follow a specific protocol (implemented in SFProtocol java class) where you receive 'T!' that is the begining of the protocol. So if you look to the server side in SerialForwarder you will be able to see how to implement the protocol.

The following code is part of sfsource.c file, part of c-based serialforwarder that you are already using.


int init_sf_source(int fd)
  95 /* Effects: Checks that fd is following the serial forwarder protocol
  96      Sends 'platform' for protocol version '!', and sets 'platform' to
  97      the received platform value.
  98    Modifies: platform
  99    Returns: 0 if it is, -1 otherwise
 100  */
 101 {
 102   char check[2], us[2];
 103   int version;
 104   unsigned char nonce[4];
 105   /* Indicate version and check if serial forwarder on the other end */
 106   us[0] = 'T'; us[1] = '!';
 107   if (safewrite(fd, us, 2) != 2 ||
 108       saferead(fd, check, 2) != 2 ||
 109       check[0] != 'T' || check[1] < ' ')
 110     return -1;
111 112 version = check[1];
 113   if (us[1] < version)
 114     version = us[1];
115 116 switch (version)
 117     {
 118     case ' ': break;
 119     case '!':
 120       nonce[0] = platform;
 121       nonce[1] = platform >>  8;
 122       nonce[2] = platform >> 16;
 123       nonce[3] = platform >> 24;
 124       if (safewrite(fd, nonce, 4) != 4)
 125    return -1;
 126       if (saferead(fd, nonce, 4) != 4)
 127    return -1;
 128       //Unlike the more general SFProtocol.java this piece of code always 
knows what platform it is connected to; just   drop the preferred platform from 
the client
 129 //platform = nonce[0] | nonce[1] << 8 | nonce[2] << 16 | nonce[3] << 24;
 130       break;
 131     }
132 133 return 0;
 134 }


Islam Hegazy escribió:
Hi
What do you mean by following the SerialForwarder protocol? I create a socket and connect it to the SF but I only receive T!- . I did another client on Windows using C# and I did the same steps but it receives normally through the socket... Regards
Islam Hegazy
    ----- Original Message -----
    *From:* Javier Barbarán Sánchez <mailto:[EMAIL PROTECTED]>
    *To:* [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> ;
    [email protected]
    <mailto:[email protected]>
    *Sent:* Monday, June 04, 2007 2:03 AM
    *Subject:* connecting to the SerialForwarder

    Hello
You must follow the SerialForwarder protocol, you can take a look
    on it in
    <tinyos_directory>\tools\java\net\tinyos\packet\SFProtocol.java
Good luck


_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to