是否可以在Window Application中使用会话概念 [英] Is it possible to use session concept in Window Application

查看:68
本文介绍了是否可以在Window Application中使用会话概念的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经为http服务器开发了一个上传文件的窗口应用程序。是否可以在窗口应用程序中使用会话概念?如果在上传文件时发生连接失败,我的应用程序只有在断开连接后才需要发送剩余文件。我问的是如何使用会话?



提前感谢

i have developed one window application for upload files to http server.is it possible to use session concept in window application?if connction failure occurs while uploding files my application need to send the remaining files only after the disconnection.so that only i am asking about how to use session for that?

thanks in advance

推荐答案

我无法帮助想知道人们如何一次又一次地问这个奇怪的问题。 Windows或Web应用程序之外的任何其他应用程序永远不需要会话支持。由于此类应用程序的极端限制特性,会为Web应用程序创建会话:HTTP协议无状态,并且应用程序的整个生命周期跨越HTTP请求和HTTP响应。你可能开发了一些Web应用程序(否则你不会问这样的问题),但我不相信你真的了解它是如何工作的。



正常(不是Web应用程序)没有这种严格的限制,所以他们不需要会话。



但是,你很可能会质疑与会话有很大不同。它可能是关于交易。你需要了解它是什么。请参阅:

http://en.wikipedia.org/wiki/Transaction_processing [< a href =http://en.wikipedia.org/wiki/Transaction_processingtarget =_ blanktitle =New Window> ^ ],

http://en.wikipedia.org/wiki/Database_transaction [ ^ ],

http ://en.wikipedia.org/wiki/Atomic_transaction [ ^ ]。



请阅读。开始理解这个想法了吗?



-SA
I cannot help wondering how people can ask this weird question again and again. Windows or any other applications other then Web application never need session support. Sessions were created for Web application only due to extremely limiting character of such applications: the HTTP protocol is stateless, and the whole lifetime of the application is spanned between an HTTP request and HTTP response. You probably develop some Web application (otherwise you would not ask such question), but I cannot believe you really understand how it works.

"Normal" (not Web applications) do not have this draconian limitation, so they don''t need sessions.

However, it is very likely that you question is related to something very different from sessions. It might be about transactions. You need to learn what it is. Please see:
http://en.wikipedia.org/wiki/Transaction_processing[^],
http://en.wikipedia.org/wiki/Database_transaction[^],
http://en.wikipedia.org/wiki/Atomic_transaction[^].

Please read it. Starting to catch the idea?

—SA


会话表示设置一个计时器,当它完成给定的时间段时,它将自动注销用户(停止所有正在运行的进程或终止应用程序) - 所以,你可以使用 计时器 在这种情况下...



在上传文件时出现连接失败的情况......

你应该 在数据库中维护一个表



添加要在数据库中上传的文件的完整列表并设置其默认值0

作为文件上传成功更新该文件的表记录并将其状态从0更改为1



所以,当你重新启动app检查数据库并开始上传状态= 0的文件时失败(意味着没有上传)



所以,它会像一个队列,你也可以提供取消按钮取消上传



希望它对你有帮助!
快乐编码!

:)
session means set a timer and when it complete a given time slot it will auto logout user (stop all running process or terminate application) - so, you can use timer in that case...

for situation of connection failure occurs while uploding files...
you should maintain a table in database

add whole list of file to upload in database and set their default value 0
as a file uploaded successfully update table record for that file and change it''s state to 1 from 0

so, when a failure occur when you restart app check database and start upload of files which have state = 0 (means not uploaded)

so, it will like a Queue and you can also provide to cancel button to cancel uploading

Hope it helped you!
Happy Coding!
:)


这篇关于是否可以在Window Application中使用会话概念的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆