Hi All,
I'm trying to connect to a virtual port (COM19, OUTGOING, "Bluetooth
Serial Port") using VS2005 System.IO.Ports.
When I ran the ff code below here's what happens.
1) VS2005 Compiles w/o errors
2) My Nokia 6600 prompted me the message "Accept Connection request
from DEMON?"
note: DEMON is my computers name.
3) Using my Nokia 6600, I hit the button that refers to the "Yes"
command.
4) Error prompted at port.Open(), saying that "The network connection
was gracefully closed."
note also that : "Passkey" is enabled on my cellphone/computer and was
entered correctly when asked.
i also so somewhere on the net that baudrate will be ignored for
bluetooth driver will be the one to autodiscover and adjust to whats
the real value? is this true?
i wish to send jpg images to my cellphone using my serial connection,
is this possible? sending out bytes of data?
I've tried using http://32feet.net/ but it proves to be difficult using
OBEX and on the fly sample projects failed to compile on VS2005.
serial connection using virtual serial ports and VS2005's new Serial
Port feature seems the easiest way to go.
Hope anyone can help out on this. I'll be very much gratefull on any
clues/leads/solutions that you may give.
Many Thanks,
Henry :)
Code Used
----------------------------------------------------------------------------------------------------
Imports System.IO.Ports
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim port As SerialPort = New SerialPort("COM19", 9600, Parity.None, 8,
StopBits.One)
port.Open()
port.Write("Hello World")
port.Close()
End Sub
----------------------------------------------------------------------------------------------------
Stack Trace
----------------------------------------------------------------------------------------------------
System.IO.IOException was unhandled
Message="The network connection was gracefully closed.
"
Source="System"
StackTrace:
at System.IO.Ports.InternalResources.WinIOError(Int32 errorCode,
String str)
at System.IO.Ports.SerialStream.InitializeDCB(Int32 baudRate,
Parity parity, Int32 dataBits, StopBits stopBits, Boolean discardNull)
at System.IO.Ports.SerialStream..ctor(String portName, Int32
baudRate, Parity parity, Int32 dataBits, StopBits stopBits, Int32
readTimeout, Int32 writeTimeout, Handshake handshake, Boolean
dtrEnable, Boolean rtsEnable, Boolean discardNull, Byte parityReplace)
at System.IO.Ports.SerialPort.Open()
at WindowsApplication1.Form1.SendSampleData() in E:\My
Documents\Visual Studio 2005\Projects\Bluetooth\Bluetooth\Form1.vb:line
17
at WindowsApplication1.Form1.Button1_Click(Object sender,
EventArgs e) in E:\My Documents\Visual Studio
2005\Projects\Bluetooth\Bluetooth\Form1.vb:line 76
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventAr gs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m,
MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at
System.Windows.Forms.Control.ControlNativeWindow.O nMessage(Message& m)
at
System.Windows.Forms.Control.ControlNativeWindow.W ndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallba ck(IntPtr
hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at
System.Windows.Forms.UnsafeNativeMethods.DispatchM essageW(MSG& msg)
at
System.Windows.Forms.Application.ComponentManager. System.Windows.Forms.UnsafeNativeMethods.IMsoCompo nentManager.FPushMessageLoop(Int32
dwComponentID, Int32 reason, Int32 pvLoopData)
at
System.Windows.Forms.Application.ThreadContext.Run MessageLoopInner(Int32
reason, ApplicationContext context)
at
System.Windows.Forms.Application.ThreadContext.Run MessageLoop(Int32
reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(ApplicationCo ntext
context)
at
Microsoft.VisualBasic.ApplicationServices.WindowsF ormsApplicationBase.OnRun()
at
Microsoft.VisualBasic.ApplicationServices.WindowsF ormsApplicationBase.DoApplicationModel()
at
Microsoft.VisualBasic.ApplicationServices.WindowsF ormsApplicationBase.Run(String[]
commandLine)
at WindowsApplication1.My.MyApplication.Main(String[] Args) in
17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
at System.AppDomain.nExecuteAssembly(Assembly assembly, String[]
args)
at System.AppDomain.ExecuteAssembly(String assemblyFile,
Evidence assemblySecurity, String[] args)
at
Microsoft.VisualStudio.HostingProcess.HostProc.Run UsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context( Object
state)
at System.Threading.ExecutionContext.Run(ExecutionCon text
executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
----------------------------------------------------------------------------------------------------