|
Hi,
sorry for cross posting - I'm a bit overworked and didn't see that there's a mobile dev forum.
I'm working on a Windows Mobile application that connects to a server on a PC.
The problem with the following lines:
CSocket as;
if(!as.Create())
MessageBox(_T("creation failed"));
if(as.Connect(_T("192.168.1.24"), 110))
MessageBox(_T("connected"));
else
MessageBox(_T("failed to connect"));
is, that Connect(...) allways returns TRUE, even if the server isn't started and even if the PC with the IP address 192.168.1.24 is switched off.
This error only occures with Windows Mobile and a WLAN connection. On Windows XP/Vista connected via WLAN/LAN or Windows Mobile connected via USB Connect(...) returns FALSE when there's no server.
Any hints?
Thanks,
Thomas
ps.: to be a bit more precise - the problematic connection is from a PDA via WLAN to a Netgear internet router and the PC is connected via LAN
|
|
|
|
|
i recently am working on the android game development !i want to achieve that the users can play the games with each other with the tcp socket or Bluetooth!
now i want to know how make the tcp connection between two emulators in different pcs successful!i can achieve it in the same pc!also i can show some code below ,i help someone can help me ?
thanks in advance!
the activity:
public class UDPConnection extends Activity { <br />
<br />
@Override <br />
public void onCreate(Bundle icicle) { <br />
super.onCreate(icicle); <br />
setContentView(R.layout.main); <br />
<br />
Thread sThread = new Thread(new Server()); <br />
Thread cThread = new Thread(new Client()); <br />
<br />
sThread.start(); <br />
try { <br />
Thread.sleep(500); <br />
} catch (InterruptedException e) { } <br />
<br />
cThread.start(); <br />
} <br />
}
the client:
public class Server implements Runnable{ <br />
public static final String SERVERIP = "127.0.0.1"; <br />
public static final int SERVERPORT = 4444; <br />
<br />
@Override <br />
public void run() { <br />
try { <br />
Log.d("UDP", "S: Connecting..."); <br />
InetAddress serverAddr = InetAddress.getByName(SERVERIP); <br />
DatagramSocket socket = new DatagramSocket(SERVERPORT,serverAddr); <br />
byte[] buf = new byte[17]; <br />
DatagramPacket packet = new DatagramPacket(buf, buf.length); <br />
Log.d("UDP", "S: Receiving..."); <br />
socket.receive(packet); <br />
Log.d("UDP", "S: Received: '" + new String(packet.getData()) + "'"); <br />
Log.d("UDP", "S: Done."); <br />
} catch (Exception e) { <br />
Log.e("UDP", "S: Error", e); <br />
} <br />
} <br />
}
the server :
public class Client implements Runnable { <br />
@Override <br />
public void run() { <br />
try { <br />
Log.d("UDP", "C: Connecting..."); <br />
DatagramSocket socket = new DatagramSocket(); <br />
byte[] buf = ("Hello from Client").getBytes(); <br />
InetAddress serverAddr = InetAddress.getByName(Server.SERVERIP); <br />
DatagramPacket packet = new DatagramPacket(buf, buf.length, serverAddr, Server.SERVERPORT); <br />
Log.d("UDP", "C: Sending: '" + new String(buf) + "'"); <br />
socket.send(packet); <br />
Log.d("UDP", "C: Sent."); <br />
Log.d("UDP", "C: Done."); <br />
} catch (Exception e) { <br />
Log.e("UDP", "C: Error", e); <br />
} <br />
} <br />
}
|
|
|
|
|
I want to make a GPRS connection from a WinCe 6.0 device over a handy. The programming language is C#. So I used PInvoke to call some API functions like ActivateDevice. Everything works fine. Just sometimes I the ActivateDevice func. returns the error 110. Especally if I call ActivateDevice/DeactivateDevice a few times. What I am doing wrong?
RegistryKey rkNewDevice = null;
RegistryKey rkPortsDevice = null;
RegistryKey rkPortsDeviceUnimodem = null;
IntPtr contextPtr = IntPtr.Zero;
string regString = string.Format("\\SOFTWARE\\Microsoft\\Bluetooth\\Device\\modem\\{0}",
Address.ToString().ToLower());
rkNewDevice = Registry.LocalMachine.CreateSubKey(regString);
if (Authenticate)
rkNewDevice.SetValue("auth", 1, RegistryValueKind.DWord);
else
rkNewDevice.SetValue("auth", 0, RegistryValueKind.DWord);
if (Encrypt)
rkNewDevice.SetValue("encrypt", 1, RegistryValueKind.DWord);
else
rkNewDevice.SetValue("encrypt", 0, RegistryValueKind.DWord);
if (rkNewDevice.GetValue("name", "").ToString() == "")
{
rkNewDevice.SetValue("name", FriendlyName);
}
regString = string.Format("\\SOFTWARE\\Microsoft\\Bluetooth\\Device\\ports\\{0}", FriendlyName);
rkPortsDevice = Registry.LocalMachine.CreateSubKey(regString);
rkPortsDevice.SetValue("dll", "btd.dll", RegistryValueKind.String);
rkPortsDevice.SetValue("prefix", "BSP", RegistryValueKind.String);
int index = FindFreePort();
rkPortsDevice.SetValue("index", index, RegistryValueKind.DWord);
PORTEMUPORTPARAMS pep = new PORTEMUPORTPARAMS();
pep.uiportflags = RFCOMM_PORT_FLAGS.REMOTE_DCB;
if (Encrypt)
pep.uiportflags |= RFCOMM_PORT_FLAGS.ENCRYPT;
if (Authenticate)
pep.uiportflags |= RFCOMM_PORT_FLAGS.AUTHENTICATE;
pep.flocal = false;
pep.device = Address.ToInt64();
pep.channel = Channel;
int size = Marshal.SizeOf(typeof(PORTEMUPORTPARAMS));
contextPtr = Marshal.AllocHGlobal(size);
Marshal.StructureToPtr(pep, contextPtr, false);
rkPortsDevice.SetValue("context", contextPtr.ToInt32(), RegistryValueKind.DWord);
if (DeviceType == DeviceTypes.MODEM ||
DeviceType == DeviceTypes.LAP ||
DeviceType == DeviceTypes.ASYNC)
{
regString = string.Format("\\SOFTWARE\\Microsoft\\Bluetooth\\Device\\ports\\{0}\\unimodem",
FriendlyName);
rkPortsDeviceUnimodem = Registry.LocalMachine.CreateSubKey(regString);
rkPortsDeviceUnimodem.SetValue("friendlyname", FriendlyName, RegistryValueKind.String);
rkPortsDeviceUnimodem.SetValue("tsp", "unimodem.dll", RegistryValueKind.String);
int devicetype = DeviceType == DeviceTypes.MODEM ? 1 : 0;
rkPortsDeviceUnimodem.SetValue("devicetype", devicetype, RegistryValueKind.DWord);
}
regString = string.Format("\\SOFTWARE\\Microsoft\\Bluetooth\\Device\\ports\\{0}", FriendlyName);
rkNewDevice.Flush();
rkPortsDevice.Flush();
rkPortsDeviceUnimodem.Flush();
IntPtr devHandle = WinNative.ActivateDevice(regString, 0);
if (devHandle != IntPtr.Zero &&
devHandle.ToInt32() != -1)
{
active = true;
Handle = devHandle.ToInt32();
rkNewDevice.SetValue("handle", Handle, RegistryValueKind.DWord);
rkNewDevice.SetValue("active", 1, RegistryValueKind.DWord);
rkNewDevice.SetValue("port_name", string.Format("BSP{0}:", index.ToString()), RegistryValueKind.String);
}
rkNewDevice.Close();
rkPortsDevice.Close();
rkPortsDeviceUnimodem.Close();
Marshal.FreeHGlobal(contextPtr);
|
|
|
|
|
Hi All,
I have a question regarding RSS...I am currently using web service to download data from server database to my mobile device(client) using web service which acts as a data access layer.Also through RSS we can download data...
1) Wat exactly is the difference between the two,Web service and RSS in terms of data fetch??
2) In what scenarios can we opt for RSS(business use case)?
Also when we create an xml doc on the server side how is it different from RSS i.e how can we say that it is an RSS feed?
Kindly provide pointers to the above mentioned querries.
Thanks in advance
|
|
|
|
|
Hi
A web service is a vague description of a remote service capable of reading requests made, most likely, over http and replying according to a predefined set of rules.
A "Service" in this case is an interface to underlying appliction/applications.
The communication scheme, syntax and process rules, is also commonly called protocol. Such protocols include XML-RPC, SOAP and REST.
RSS, Atom are examples of definitions for stuctured data such as news items etc
In a web service call, such as an XML-RPC or SOAP call, you can include content such as RSS or Atom.
A simple top down example of dependances in a web service call:
RSS (Human Readable Data)
|
V
SOAP (Method Call Defenition Protocol)
|
V
HTTP (High Level Transport Protocol)
|
V
TCP-IP (Low Level Transport Protocol)
What you are aiming at, i guess, is the manner to make calls and handle responses,
* REST (Representational State Transfer) services include most RSS and ATOM feeds. REST means that you use HTTP (GET,PUT,DELETE) as protocol for retrieving (GET), updating (PUT) and deleting (DELETE) items on the remote end. REST skips the overhead of SOAP/XML-RPC and is a very fast and light weight way of communicating with a web service.
* SOAP (Simple Object Access Protocol) is however the most supported way of sending requests and recieveing responses on the CE platform. It is actually the technology of choice for the entire .NET paradigm. Its rather bulky though...
* XML-RPC (XML Remote Procedure Call) is a very simplified protocol way of making Web Service calls. Because of its simplicity this is the choice for many developers outside the MS sphere.
Hope this helps,
Lars
modified on Tuesday, August 4, 2009 12:01 PM
|
|
|
|
|
very good and apt answer.... voted as good... im also working on an application which uses both
This code was posted by me...
|
|
|
|
|
I tried to consume a web service with smart phone application using VS 2005 i get the following errors when i try to test my project. my immediate windows shows the following:
A first chance exception of type 'System.Net.WebException' occurred in System.dll
A first chance exception of type 'System.Net.WebException' occurred in System.Web.Services.dll
while the error message i get is this:
System.Net.WebException was unhandled
Message="WebException"
I'll be glad if someone can help me with this urgently
|
|
|
|
|
Regarding the first chance exception, I would tell you that you might not need to worry about sometimes.
Go throough this article[^].
|
|
|
|
|
i'm working on a mobile development project and i successfully completed it, now i'm creating the cab file,several times i cretaed the cab file and deployed in the mobile device successfully, but suddenly i got a build error saying unable to build it .i surfed the net and found no solution for this, i'm expecting a solution for this problem ,want to know why this happens suddenly,it worked properly and suddenly failed.
|
|
|
|
|
|
i use a month calendar in mfc dlg,it can be build in shared dll,but can't build when use static library.
error:"unresolved external symbol "void __cdecl DDX_MonthCalCtrl(class CDataExchange *,int,class CTime &)" (?DDX_MonthCalCtrl@@YAXPAVCDataExchange@@HAAVCTime@@@Z) referenced in function "protected: virtual void __cdecl"
how to solve this problem?
SDK is ppc 2003;EVC 4.0
modified on Friday, July 31, 2009 4:07 AM
|
|
|
|
|
Hello,
I'm learning C++, but i only develop console apps, because graphical C++ development is so much difficult, then i want to know if i can develop console like apps for Palm OS, what i want is this, compile this code for Palm OS for example:
#include <iostream>
using std::cerr;
using std::cin;
using std::cout;
using std::endl;
using std::ios;
#include <fstream>
using std::ofstream;
#include <cstdlib>
using std::exit;
int main()
{
ofstream outClientFile( "Clients.dat", ios::out );
if ( !outClientFile )
{
cerr << "File could not be opened" << endl;
exit( 1 );
}
cout << "Enter the account, name, and balance." << endl
<< "Enter end-of-file to end the input.\n? ";
int account;
char name[ 30 ];
double balance;
while ( cin >> account >> name >> balance )
{
outClientFile << account << ' ' << name << ' ' << balance << endl;
cout << "? ";
}
return 0;
}
Thanks,
Nathan Paulino Campos
Jornada 720 - Windows CE 3.00 - ARM Processor
Palm T|X - PalmOS 5
|
|
|
|
|
You can now post your application onto Windows Marketplace for Mobile[^]. Submissions for mobile-device applications will be accepted from 29 supported countries.
Windows Marketplace for Mobile will go live this fall.
Initially Windows Marketplace for Mobile will support applications for Windows Mobile 6.5. Windows Marketplace for Mobile will also be available to Windows Mobile 6.0 and 6.1 devices by the end of 2009. This means that you can reach more than 30 million Windows Mobile devices.
For more information, see http://tinyurl.com/nlg3wm[^]
|
|
|
|
|
Hi,
I want to show a tooltip.
How to show a tooltip in Win Ce?
what a class and namespace is for it?
Or i must use a API function? what?
Thanks
|
|
|
|
|
obalesu wrote: what a class and namespace is for it?
Call the CreateWindowEx function and specify the TOOLTIPS_CLASS window class. Details Here[^]
|
|
|
|
|
Hi Joshi,
Thanks for sending reply.but i am new to calling win32 functions can you please send one example creatingTooltip in windows ce 5.0 application i am using .net 2005.
Thanks.
|
|
|
|
|
This[^] article explains it and has some examples source code in it. It is not for WinCE though, but it uses the same CreateWindowEx() API.
|
|
|
|
|
Hay, I'm taying to make a simple Rest web service in C# and client on android.
I find a simple C# web service, which add two number, on this link:
http://www.c-sharpcorner.com/UploadFile/dhananjaycoder/RESTEnabledService05122009034907AM/RESTEnabledService.aspx
Can anyone help me to make Android client for this web service
Thanks
|
|
|
|
|
Hi struja_ns, hope u r doing gr8.... m having same issue as u mentioned in this thread:
"I'm trying to make a simple Rest web service in C# and client on android.
I find a simple C# web service,"
Please share any solution with me if u found any ... your help will b appreciated.
Regards,
Faheem Sial,
faheemsial@gmail.com
|
|
|
|
|
Hello!
I’m writing an Application that I created in Visual C#. The application is
a Serial Com Terminal. I want this to run as a Windows CE Application in my device emulator. But it’s doesn’t really work. I don’t’ have any error but I can’t send other received any message from the serial port.
Can anyone please help me out in this?
Thanks in advance
Chinco
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Threading;
using System.IO;
using System.IO.Ports;
namespace MyCETerminalChat
{
public partial class Form1 : Form
{
string name;
string message;
StringComparer stringComparer = StringComparer.OrdinalIgnoreCase;
// Create a new SerialPort object with default settings.
SerialPort sp = new SerialPort();
public Form1()
{
InitializeComponent();
string[] ports = SerialPort.GetPortNames();
foreach (string port in ports)
{
cboPort.Items.Add(port);
}
}
private void cmdOpen_Click(object sender, EventArgs e)
{
try
{
sp = new SerialPort(cboPort.SelectedItem.ToString());
sp.BaudRate = int.Parse(cboBaud.SelectedItem.ToString());
// Set the read/write timeouts
sp.WriteTimeout = 500;
sp.ReadTimeout = 500;
sp.Parity = Parity.None;
sp.DataBits = 8;
sp.StopBits = StopBits.One;
sp.Handshake = Handshake.None;
sp.Open();
if (sp.IsOpen == true)
{
MessageBox.Show("Success");
cmdOpen.Enabled = false;
cmdClose.Enabled = true;
cmdSend.Enabled = true;
}
else
MessageBox.Show("Port no Connect");
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
private void cmdSend_Click(object sender, EventArgs e)
{
string msg = txtSend.Text;
textBox1.Text += (msg);
sp.Write(msg);
txtSend.Text = "";
}
private void cmdClose_Click(object sender, EventArgs e)
{
sp.Close();
cmdOpen.Enabled = true;
cmdClose.Enabled = false;
cmdSend.Enabled = false;
}
delegate void ChangeTxtReciveTextDelegate(string newText);
private void ChangeTxtReciveText(string newText)
{
if (textBox1.InvokeRequired)
textBox1.Invoke(new ChangeTxtReciveTextDelegate(ChangeTxtReciveText), newText);
else
textBox1.Text = newText;
}
public void Read()
{
try
{
string message = sp.ReadExisting();
MessageBox.Show("Selected Item Text: " + message);
ChangeTxtReciveText(message);
}
catch (TimeoutException) { }
}
}
}
|
|
|
|
|
Hi, all.
I am developing a PocketPC Application in Visual Basic2008(VB.Net) and Compact Framework2.0.There I was declared a Parent form and four child form.There I declared in child form load event:
Me.Parent=MainForm
It's working fine.But when I switched to Compact framework3.5.This code shows error.
"Values Does not Fall within the Expected Range."
Please help me.
|
|
|
|
|
Try to debug your application in compact framework 3.5 and find out where erectly error is raised. because this error is raised basically some invalid argument send to common language runtime.
Pavan Pareta
|
|
|
|
|
Thanks for your reply.I run this in debug mode in compact framework 3.5.I declare the form is
Dim Config As frmConfig
After that I wrote
Config=New frmConfig()
Config.Show()
After executing of last line the same error is coming at the same line.
Me.Parent = frmMDIMain
|
|
|
|
|
I have a requirement. In grid view 3 columns, 1st column - text, 2nd column - Text, 3rd column - ComboBox(twist is that, depending on the 2nd column only 3rd column's items should populate)
e.g:
-------------------------------------------------------------------
Item Operation Status (combobox items)
-------------------------------------------------------------------
Door Cleaning status Cleaned,Not Cleaned,Avg Cleaned
Bathroom Water availability Full, Empty
Bar Availability Empty,10-20,20-30,30-40
Window Cleaning status Cleaned,Not Cleaned,Avg Cleaned
on click of save button, I have to save to DB(loop and save)
So How Can I achive this task..... Anyone give idea.....
|
|
|
|
|
Hi
how to take screenshots on windows ce (5.0) device like prt scr button in pc.
Thanks.
|
|
|
|
|